def test_approval(self):
        """
        Approval of an account functions properly.

        """
        resp = self.client.post(reverse('registration_register'),
                                data={
                                    'username': '******',
                                    'email': '*****@*****.**',
                                    'password1': 'secret',
                                    'password2': 'secret'
                                })

        profile = self.registration_profile.objects.get(user__username='******')

        resp = self.client.get(
            reverse('registration_activate',
                    args=(),
                    kwargs={'activation_key': profile.activation_key}))

        admin_user = UserModel().objects.create_superuser(
            'admin', '*****@*****.**', 'admin')
        self.client.login(username=admin_user.get_username(),
                          password=admin_user)

        resp = self.client.get(
            reverse('registration_admin_approve',
                    args=(),
                    kwargs={'profile_id': profile.id}))
        user = profile.user
        # fail if the user is active (this should not happen yet)
        self.failIf(not user.is_active)
        self.assertRedirects(resp, reverse('registration_approve_complete'))
    def setUp(self):
        self.client = Client()
        admin_user = UserModel().objects.create_superuser(
            'admin', '*****@*****.**', 'admin')
        self.client.login(username=admin_user.get_username(),
                          password=admin_user)

        self.user_info = {
            'username': '******',
            'password': '******',
            'email': '*****@*****.**'
        }