def test_registration_form_password_missing(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'password1': 'tester40', }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Second Password is missing", form.full_clean())
def test_registration_form_missing_email(self): form = UserRegistrationForm({ 'password1': 'test35', 'password2': 'test35', }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Please enter your email address", form.full_clean())
def test_registration_form_passwords_not_matching(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'password1': 'tester38', 'password2': 'tester39', }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Passwords do not match", form.full_clean())
def test_registration_form_fails_with_missing_password2(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'public_name': 'test name 4', 'password1': 'testpassword1' }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Passwords do not match", form.full_clean())
def test_registration_form_fails_with_missing_password(self): form = UserRegistrationForm({ 'username': '******', 'email': '*****@*****.**', 'password1': 'letmein1', }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "please enter both passwords", form.full_clean())
def test_registration_form_fails_with_missing_public_name(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'password1': 'testpassword1', 'password2': 'testpassword1' }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Please fill in this field", form.full_clean())
def test_registration_form_fails_wih_passwords_that_dont_match(self): form = UserRegistrationForm({ 'username': '******', 'email': '*****@*****.**', 'password1': 'testing1', 'password2': 'testing2' }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Passwords do not match", form.full_clean())
def test_registration_form_fails_wih_passwords_that_dont_match(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'password1': 'letmein1', 'password2': 'letmein2', 'stripe_id': settings.STRIPE_SECRET, 'credit_card_number': 4242424242424242, 'cvv': 123, 'expiry_month': 1, 'expiry_year': 2033 }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Passwords do not match", form.full_clean())
def test_registration_form_fails_with_missing_password(self): form = UserRegistrationForm({ 'email': '*****@*****.**', 'password1': 'letmein1', 'stripe_id': settings.STRIPE_SECRET, 'credit_card_number': 4242424242424242, 'cvv': 123, 'expiry_month': 1, 'expiry_year': 2033 }) self.assertFalse(form.is_valid()) self.assertRaisesMessage(forms.ValidationError, "Please re-type your password", form.full_clean())