def test_register_gender_required(self): form_data = { 'username': '******', 'password': '******', 'security_question_1_answer': 'dog', 'security_question_2_answer': 'cat' } form = GemRegistrationForm(data=form_data) self.assertEqual(form.is_valid(), False)
def test_register_security_question_2_answer_required(self): form_data = { 'username': '******', 'password': '******', 'gender': 'm', 'security_question_1_answer': 'dog' } form = GemRegistrationForm(data=form_data) self.assertFalse(form.is_valid())
def test_registration_form_removes_unwanted_fields(self): form_data = { 'email': '*****@*****.**', 'location': '123 Street, City, Country', 'mobile_number': '+27710123456', } form = GemRegistrationForm(data=form_data) form.is_valid() self.assertEqual(form.cleaned_data['email'], None) self.assertEqual(form.cleaned_data['location'], None) self.assertEqual(form.cleaned_data['mobile_number'], None)