-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Test factories for the new consultation models. | ||
""" | ||
import pytest | ||
from consultation_analyser import factories2 | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_factories(): | ||
# just check nothing fails | ||
factories2.UserFactory() | ||
factories2.Consultation2Factory() | ||
factories2.QuestionGroupFactory() | ||
factories2.Question2Factory() | ||
factories2.QuestionPartFactory() | ||
factories2.ExpandedQuestionFactory() | ||
factories2.RespondentFactory() | ||
factories2.Answer2Factory() | ||
factories2.ExecutionRunFactory() | ||
factories2.FrameworkFactory() | ||
factories2.Theme2Factory() | ||
factories2.ThemeMappingFactory() | ||
factories2.SentimentMappingFactory() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
|
||
from consultation_analyser.factories2 import Consultation2Factory, Question2Factory | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_consultation_save(): | ||
consultation_title = "My First Consultation" | ||
slugified = "my-first-consultation" | ||
consultation = Consultation2Factory(text=consultation_title) | ||
assert consultation.slug.startswith(slugified) | ||
another_consultation = Consultation2Factory(text=consultation_title) | ||
assert another_consultation.slug != consultation.slug | ||
assert another_consultation.slug.startswith(slugified) | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_question_save(): | ||
question_text = "What are your thoughts on the proposed changes?" | ||
slugified = "what-are-your-thoughts-on-the-proposed-changes" | ||
question = Question2Factory(text=question_text) | ||
assert question.slug.startswith(slugified) | ||
another_question = Question2Factory(text=question_text) | ||
assert another_question.slug != question.slug | ||
assert another_question.slug.startswith(slugified) | ||
|
||
|
||
|
||
|