forked from LinkedInLearning/django-esst-2894047
-
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.
LinkedInLearning#1 added test script for home app
- Loading branch information
Showing
4 changed files
with
29 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
from django.contrib.auth.models import User | ||
|
||
def test_home_view(client): | ||
response = client.get(path='/') | ||
assert response.status_code==200 | ||
assert 'Welcome to SmartNotes!' in str(response.content) | ||
|
||
def test_signup(client): | ||
response = client.get(path='/signup') | ||
assert response.status_code==200 | ||
assert 'home/register.html' in response.template_name | ||
|
||
#create temporary test database | ||
@pytest.mark.django_db | ||
def test_signup_authenticated(client): | ||
user= User.objects.create_user('Kim','[email protected]','password') | ||
client.login(username= user.username, password = 'password') | ||
#follow= true means follow the url status code in this example a url is redirected will return code 302 | ||
response = client.get(path='/signup',follow=True) | ||
assert 200 == response.status_code | ||
assert 'notes/notes_list.html' in response.template_name |
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,7 @@ | ||
import pytest | ||
from django.contrib.auth.models import User | ||
|
||
@pytest.mark.django_db | ||
def test_list_endpoint_return_user_notes(client): | ||
user= User.objects.create_user('Kim','[email protected]','password') | ||
client.login(username= user.username, password = 'password') |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -121,8 +121,6 @@ | |
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
|