Commits

James Bennett  committed 9ea59b4

Test disallowed_url argument to registration view.

  • Participants
  • Parent commits 8881091

Comments (0)

Files changed (1)

File registration/tests/views.py

         response = self.client.get(reverse('registration_test_register_extra_context'))
         self.assertEqual(response.context['foo'], 'bar')
 
+    def test_registration_disallowed_url(self):
+        """
+        Passing ``disallowed_url`` to the ``register`` view will
+        result in a redirect to that URL when registration is closed.
+        
+        """
+        old_allowed = getattr(settings, 'REGISTRATION_OPEN', True)
+        settings.REGISTRATION_OPEN = False
+
+        closed_redirect = 'http://testserver%s' % reverse('registration_test_custom_disallowed')
+
+        response = self.client.get(reverse('registration_test_register_disallowed_url'))
+        self.assertRedirects(response, closed_redirect)
+
+        settings.REGISTRATION_OPEN = old_allowed
+
     def test_valid_activation(self):
         """
         Test that the ``activate`` view properly handles a valid