Commits

James Bennett  committed 0d57041

Test template_name argument to activation view.

  • Participants
  • Parent commits 9ea59b4

Comments (0)

Files changed (2)

File registration/test_urls.py

 urlpatterns = patterns('',
                        # Test the 'activate' view with custom template
                        # name.
-                       url(r'^activate-with-template-name/$',
+                       url(r'^activate-with-template-name/(?P<activation_key>\w+)/$',
                            activate,
                            {'template_name': 'registration/test_template_name.html'},
                            name='registration_test_activate_template_name'),
                        # Test the 'activate' view with
                        # extra_context_argument.
-                       url(r'^activate-extra-context/$',
+                       url(r'^activate-extra-context/(?P<activation_key>\w+)/$',
                            activate,
                            {'extra_context': {'foo': 'bar'}},
                            name='registration_test_activate_extra_context'),

File registration/tests/views.py

         self.assertEqual(response.status_code, 200)
         self.failIf(response.context['account'])
         self.failIf(User.objects.get(username='bob').is_active)
+
+    def test_activation_template_name(self):
+        """
+        Passing ``template_name`` to the ``activate`` view will result
+        in that template being used.
+
+        """
+        response = self.client.get(reverse('registration_test_activate_template_name',
+                                   kwargs={'activation_key': 'foo'}))
+        self.assertTemplateUsed(response, 'registration/test_template_name.html')