def test_conf_reg_block_without_question_or_answer_passes_validation(self): block = ConferenceRegistrationForm() value = block.to_python({ 'govdelivery_code': 'USCFPB_999', 'capacity': 123, 'success_message': 'Success message', 'at_capacity_message': 'At capacity message', 'failure_message': 'Failure message' }) try: block.clean(value) except ValidationError: self.fail('no question and no answer should not fail validation')
def test_conf_reg_block_with_answer_but_no_question_fails_validation(self): block = ConferenceRegistrationForm() value = block.to_python({ 'govdelivery_code': 'USCFPB_999', 'govdelivery_question_id': '', 'govdelivery_answer_id': '67890', 'capacity': 123, 'success_message': 'Success message', 'at_capacity_message': 'At capacity message', 'failure_message': 'Failure message' }) with self.assertRaises(ValidationError): block.clean(value)
def test_conf_reg_block_without_question_or_answer_passes_validation(self): block = ConferenceRegistrationForm() value = block.to_python({ 'govdelivery_code': 'USCFPB_999', 'capacity': 123, 'success_message': 'Success message', 'at_capacity_message': 'At capacity message', 'failure_message': 'Failure message' }) self.assertTrue(block.clean(value))
def test_conf_reg_block_with_answer_but_no_question_fails_validation(self): block = ConferenceRegistrationForm() value = block.to_python({'govdelivery_answer_id': '67890'}) with self.assertRaises(ValidationError): block.clean(value)