-
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.
- Loading branch information
1 parent
4165a81
commit bf3654c
Showing
5 changed files
with
37 additions
and
3 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,15 @@ | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from django.contrib.auth.models import User | ||
|
||
# Create your tests here. | ||
|
||
class TestDownloadView(TestCase): | ||
def test_anonymous_cannot_see_page(self): | ||
response = self.client.get(reverse("test")) | ||
assert response.status_code == 302 | ||
|
||
def test_authenticated_user_can_see_page(self): | ||
user = User.objects.create_user("Juliana," "[email protected]", "some_pass") | ||
self.client.force_login(user=user) | ||
response = self.client.get(reverse("test")) | ||
assert response.status_code == 200 |
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
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,4 @@ | ||
[pytest] | ||
DJANGO_SETTINGS_MODULE = django_playground.settings | ||
# -- recommended but optional: | ||
python_files = tests.py test_*.py *_tests.py |
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