diff --git a/home/tests/test_views.py b/home/tests/test_views.py index e69de29b..30ee2c9a 100644 --- a/home/tests/test_views.py +++ b/home/tests/test_views.py @@ -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','kim@test.com','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 \ No newline at end of file diff --git a/notes/test_notes_views.py b/notes/test_notes_views.py new file mode 100644 index 00000000..e379a9b1 --- /dev/null +++ b/notes/test_notes_views.py @@ -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','kim@test.com','password') + client.login(username= user.username, password = 'password') diff --git a/notes/tests.py b/notes/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/notes/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/smartnotes/settings.py b/smartnotes/settings.py index 6d801bf5..75f4307a 100644 --- a/smartnotes/settings.py +++ b/smartnotes/settings.py @@ -121,8 +121,6 @@ USE_I18N = True -USE_L10N = True - USE_TZ = True