Patrick Arminio
1 year ago
Failed to extract signature
1 changed files with
18 additions and
0 deletions
-
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"} |
|
|