def test_fail(self): u = UserFactory() v = EmailVerification(user=u) v.reset() response = self.client.get(reverse('resturo_user_verify'), {'token': 'totally-wrong-token'}) self.assertEquals(response.status_code, status.HTTP_400_BAD_REQUEST) v = EmailVerification.objects.get(pk=v.id) self.assertFalse(v.verified)
def test_succeed(self): u = UserFactory() v = EmailVerification(user=u) v.reset() response = self.client.get(reverse('resturo_user_verify'), {'token': v.token}) self.assertEquals(response.status_code, status.HTTP_200_OK) v = EmailVerification.objects.get(pk=v.id) self.assertTrue(v.verified)