diff options
author | luxagraf <sng@luxagraf.net> | 2021-08-14 09:39:08 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2021-08-14 09:39:08 -0400 |
commit | 9327e01c60b114286f5a142552aae60843029a48 (patch) | |
tree | 7f353f4299d50013c3b90f7b749fc6ab211b32d4 /app/accounts/tests/test_views.py | |
parent | 0feb366b10cf422f12d18fa753e5d876120f4195 (diff) |
initial commit
Diffstat (limited to 'app/accounts/tests/test_views.py')
-rw-r--r-- | app/accounts/tests/test_views.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/accounts/tests/test_views.py b/app/accounts/tests/test_views.py new file mode 100644 index 0000000..39dcb31 --- /dev/null +++ b/app/accounts/tests/test_views.py @@ -0,0 +1,23 @@ +from django.test import Client +from django.test import RequestFactory, TestCase +from mixer.backend.django import mixer + +from accounts.models import User +from accounts.views import ProfileView + + +class ProfileViewTest(TestCase): + def setUp(self): + # Every test needs access to the request factory. + self.factory = RequestFactory() + self.user = mixer.blend(User, username='tpynchon', password="gravity") + + def test_profile_view(self): + request = self.factory.get('/settings/') + request.user = self.user + response = ProfileView.as_view()(request) + self.assertEqual(response.status_code, 200) + response.render() + html = response.content.decode('utf8') + self.assertTrue(html.startswith('<!DOCTYPE html>')) + self.assertIn('<h1>Account Settings</h1>', html) |