Browse Source

Add missing tests

pull/11782/head
Patrick Arminio 1 year ago
parent
commit
d259c13380
Failed to extract signature
  1. 18
      tests/test_tutorial/test_django_orm/test_tutorial001.py

18
tests/test_tutorial/test_django_orm/test_tutorial001.py

@ -48,3 +48,21 @@ def test_question_empty():
assert response.status_code == 200, response.text assert response.status_code == 200, response.text
assert response.json() == [] assert response.json() == []
def test_get_questions_async():
Question.objects.create(question_text="everlong", pub_date=timezone.now())
response = client.get("/questions-async")
assert response.status_code == 200, response.text
assert response.json() == [{"question": "everlong"}]
def test_get_single_question():
question = Question.objects.create(question_text="my hero", pub_date=timezone.now())
response = client.get(f"/questions/{question.id}")
assert response.status_code == 200, response.text
assert response.json() == {"question": "my hero"}

Loading…
Cancel
Save