'Ask for a new activation link'

def test_retry_activation_ask(self):

    userena_settings.USERENA_ACTIVATION_RETRY = True
    self.client.post(reverse('userena_signup'), data={'username': 'alice', 'email': 'alice@example.com', 'password1': 'swordfish', 'password2': 'swordfish', 'tos': 'on'})
    user = User.objects.get(email='alice@example.com')
    user.date_joined = (datetime.today() - timedelta(days=30))
    user.save()
    old_key = user.userena_signup.activation_key
    response = self.client.get(reverse('userena_activate_retry', kwargs={'activation_key': old_key}))
    user = User.objects.get(email='alice@example.com')
    self.assertContains(response, 'Account    re-activation    succeeded')
    self.assertNotEqual(old_key, user.userena_signup.activation_key)
    user = User.objects.get(email='alice@example.com')
    self.assertTrue((not user.is_active))
    self.assertEqual(len(mail.outbox), 2)
    self.assertEqual(mail.outbox[1].to, ['alice@example.com'])
    self.assertTrue((mail.outbox[1].body.find('activate    your    account    ') > (-1)))
    response = self.client.get(reverse('userena_activate', kwargs={'activation_key': user.userena_signup.activation_key}))
    self.assertRedirects(response, reverse('userena_profile_detail', kwargs={'username': user.username}))
    user = User.objects.get(email='alice@example.com')
    self.assertTrue(user.is_active)
    userena_settings.USERENA_ACTIVATION_RETRY = False
