forked from gundotio/worf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gundotio#56: Test to simulate a view without model
- Increasing the test scenarios
- Loading branch information
1 parent
3e6cd37
commit 4d82b94
Showing
3 changed files
with
32 additions
and
9 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import pytest | ||
|
||
from datetime import timedelta | ||
from unittest.mock import patch | ||
from uuid import uuid4 | ||
|
@@ -509,8 +511,21 @@ def test_user_update(client, db, method, user): | |
assert result["email"] == "[email protected]" | ||
|
||
|
||
def test_when_using_a_view_without_model_must_return_expected_result(client): | ||
response = client.get("/without-model/") | ||
def test_when_using_a_detail_view_without_model_must_return_expected_result(client): | ||
response = client.get("/without-model/detail") | ||
assert response | ||
assert response.status_code == 200, response | ||
assert response.json() == {"field_name": "field_value"} | ||
|
||
|
||
def test_when_using_a_list_view_without_model_must_return_expected_result(client): | ||
with pytest.raises(AttributeError): | ||
response = client.get("/without-model/") | ||
|
||
|
||
def test_when_using_a_list_view_without_model_but_with_queryset_must_return_expected_result(client): | ||
with pytest.raises(AttributeError): | ||
response = client.get("/without-model-queryset/") | ||
|
||
|
||
|
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
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