def setUp(self):
     factory = RequestFactory()
     request = factory.get(reverse('registration_register'))
     SessionMiddleware().process_request(request)
     self.user = RegisterView().register(request, email='*****@*****.**')
     self.user.set_unusable_password()
     self.activation_key = user_to_activation_key(self.user)
 def test_activation_key_cycle(self):
     u = User.objects.create_user('username', '*****@*****.**')
     activation_key = user_to_activation_key(u)
     retrieved_user = activation_key_to_user(activation_key)
     self.assertEqual(u, retrieved_user)