Skip to content

Commit

Permalink
Change field value to topic
Browse files Browse the repository at this point in the history
As field value is removed from model Result
  • Loading branch information
juuso-j committed Feb 14, 2024
1 parent f3721da commit 0023a1c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions profiles/tests/api/test_answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_post_answer(api_client_authenticated, users, questions, options):
assert response.status_code == 201
assert Answer.objects.count() == 1
user.refresh_from_db()
assert user.result.value == "negative result"
assert user.result.topic == "negative"


@pytest.mark.django_db
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_answer_get_result(api_client_authenticated, users, answers):
url = reverse("profiles:answer-get-result")
response = api_client_authenticated.get(url)
assert response.status_code == 200
assert response.json()["value"] == "negative result"
assert response.json()["topic"] == "negative"


@pytest.mark.django_db
Expand Down
4 changes: 2 additions & 2 deletions profiles/tests/api/test_postal_code_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def test_postal_code_result(api_client, questions, sub_questions, options, resul
start_poll_url = reverse("profiles:question-start-poll")
end_poll_url = reverse("profiles:question-end-poll")
answer_url = reverse("profiles:answer-list")
positive_result = results.get(value="positive result")
negative_result = results.get(value="negative result")
positive_result = results.get(topic="positive")
negative_result = results.get(topic="negative")
question1 = questions.get(number="1")
question2 = questions.get(number="2")
car_sub_q = sub_questions.get(question=question2, description="car")
Expand Down
4 changes: 2 additions & 2 deletions profiles/tests/api/test_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def test_questions(api_client, questions, question_conditions, options, results)
== question.options.first().results.count()
)
assert (
json_response["options"][0]["results"][0]["value"]
== results.filter(options__question=question).first().value
json_response["options"][0]["results"][0]["topic"]
== results.filter(options__question=question).first().topic
)


Expand Down
8 changes: 4 additions & 4 deletions profiles/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def sub_questions(questions):
@pytest.mark.django_db
@pytest.fixture
def options(questions, sub_questions, results):
positive_result = results.get(value="positive result")
negative_result = results.get(value="negative result")
positive_result = results.get(topic="positive")
negative_result = results.get(topic="negative")
question1 = questions.get(number="1")
option_no = Option.objects.create(value="no", question=question1)
option_no.results.add(negative_result)
Expand Down Expand Up @@ -93,8 +93,8 @@ def options(questions, sub_questions, results):
@pytest.mark.django_db
@pytest.fixture
def results():
Result.objects.create(topic="negative", value="negative result")
Result.objects.create(topic="positive", value="positive result")
Result.objects.create(topic="negative", description="negative result")
Result.objects.create(topic="positive", description="positive result")
return Result.objects.all()


Expand Down

0 comments on commit 0023a1c

Please sign in to comment.