Commits

James Bennett committed acbbff1

Add the rest and make the test pass.

Comments (0)

Files changed (2)

registration/backends/default/__init__.py

     fields and supported operations.
     
     """
-    def register(self, request, username, email, password):
+    def register(self, request, **kwargs):
         """
         Given a username, email address and password, register a new
         user account, which will initially be inactive.
         them.
 
         """
+        username, email, password = kwargs['username'], kwargs['email'], kwargs['password1']
         if Site._meta.installed:
             site = Site.objects.get_current()
         else:

registration/tests.py

         email.
         
         """
-        new_user = self.backend.register({}, 'bob', 'bob@example.com', 'secret')
+        new_user = self.backend.register({}, username='bob', email='bob@example.com', password1='secret')
         self.assertEqual(new_user.username, 'bob')
         self.failUnless(new_user.check_password('secret'))
         self.assertEqual(new_user.email, 'bob@example.com')
         """
         # First, test with a user activating inside the activation
         # window.
-        valid_user = self.backend.register({}, 'alice', 'alice@example.com', 'swordfish')
+        valid_user = self.backend.register({}, username='alice', email='alice@example.com', password1='swordfish')
         valid_profile = RegistrationProfile.objects.get(user=valid_user)
         activated = self.backend.activate({}, valid_profile.activation_key)
         self.assertEqual(activated.username, valid_user.username)
 
         # Now test again, but with a user activating outside the
         # activation window.
-        expired_user = self.backend.register({}, 'bob', 'bob@example.com', 'secret')
+        expired_user = self.backend.register({}, username='bob', email='bob@example.com', password1='secret')
         expired_user.date_joined = expired_user.date_joined - datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
         expired_user.save()
         expired_profile = RegistrationProfile.objects.get(user=expired_user)
                                            'email': 'alice@example.com',
                                            'password1': 'swordfish',
                                            'password2': 'swordfish' })
-        self.assertEqual(response.status_code, 200)
+        self.assertEqual(response.status_code, 302)
+        self.assertEqual(response['Location'], 'http://testserver%s' % reverse('registration_complete'))
         self.assertEqual(len(mail.outbox), 1)