class UpdatesRegistrationTestCase(unittest.TestCase): def setUp(self): self.registered_user_email = "*****@*****.**" self.registered_user = UpdatesRegistration(email=self.registered_user_email) self.registered_user.save() def tearDown(self): self.registered_user.delete() def test_if_get_register_validate_existing_user(self): self.assertTrue(UpdatesRegistration.objects.is_registered(self.registered_user_email)) def test_if_get_register_validate_non_existing_user(self): self.assertFalse(UpdatesRegistration.objects.is_registered("*****@*****.**"))
class UpdatesRegistrationTestCase(unittest.TestCase): def setUp(self): self.registered_user_email = "*****@*****.**" self.registered_user = UpdatesRegistration( email=self.registered_user_email) self.registered_user.save() def tearDown(self): self.registered_user.delete() def test_if_get_register_validate_existing_user(self): self.assertTrue( UpdatesRegistration.objects.is_registered( self.registered_user_email)) def test_if_get_register_validate_non_existing_user(self): self.assertFalse( UpdatesRegistration.objects.is_registered("*****@*****.**"))
def notify_and_redirect(self): new_request = UpdatesRegistration(email=self.email) as_been_sent = _send_email(self.email_confirmation, EMAILS["CONTACT"]["FROM"]) new_request.save() redirect = urlresolvers.reverse('updates_registration.views.register_success') return HttpResponseRedirect(redirect)