def test_registration_form_with_tos_checkbox_validates(self): data = { 'email': '*****@*****.**', 'password1': 'Pa$sw0rd', 'password2': 'Pa$sw0rd', 'tos': True } form = RegistrationFormTermsOfService(data=data) self.assertTrue(form.is_valid())
def test_registration_form_with_tos_checkbox_fails(self): data = { 'email': '*****@*****.**', 'password1': 'Pa$sw0rd', 'password2': 'Pa$sw0rd', } form = RegistrationFormTermsOfService(data=data) self.assertFalse(form.is_valid()) self.assertEqual(form.errors['tos'], [u'You must agree to the terms to register'])