Skip to content

Commit

Permalink
Add test for registration view.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Oct 24, 2023
1 parent 2979a8d commit 8c15abb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions g3w-admin/usersmanage/tests/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,23 @@ def test_registration_view(self):
self.assertEqual(ntu.userbackend.backend, USER_BACKEND_DEFAULT)
self.assertEqual(ntu.userdata.other_info, 'Give you more information about me!!')

# Test Registration page with authenticated user
self.client.login(username=self.test_admin1.username, password=self.test_admin1.username)
res = self.client.get(rpath)

self.assertEqual(res.status_code, 302)
self.assertEqual(res.url, reverse('django_registration_disallowed'))

self.client.logout()


@override_settings(REGISTRATION_OPEN=False)
def test_registration_view_registration_not_active(self):

rpath = reverse('django_registration_register')
res = self.client.get(rpath)

self.assertEqual(res.status_code, 302)
self.assertEqual(res.url, reverse('django_registration_disallowed'))


0 comments on commit 8c15abb

Please sign in to comment.