def test_registration_form_tos(self): """ Test that ``RegistrationFormTermsOfService`` requires agreement to the terms of service. """ form = forms.RegistrationFormTermsOfService( data={ 'username': '******', 'email': '*****@*****.**', 'password1': 'foo', 'password2': 'foo' }) self.failIf(form.is_valid()) self.assertEqual(form.errors['tos'], [u"You must agree to the terms to register"]) form = forms.RegistrationFormTermsOfService( data={ 'username': '******', 'email': '*****@*****.**', 'password1': 'foo', 'password2': 'foo', 'tos': 'on' }) self.failUnless(form.is_valid())
def test_registration_form_tos(self): """Test that ``RegistrationFormTermsOfService`` requires agreement.""" no_tos = self.__good_data del no_tos['tos'] form = forms.RegistrationFormTermsOfService(data=no_tos) self.failIf(form.is_valid()) self.assertEqual(form.errors['tos'], [u"You must agree to the terms to register."])