Example #1
0
 def test_that_mising_extra_data_causes_message_validation_error(self):
     del self.compute_task_def['extra_data']
     with pytest.raises(ConcentValidationError) as exception_wrapper:
         validate_compute_task_def(self.compute_task_def)
     assert_that(
         exception_wrapper.value.error_message).contains(f"extra_data")
     assert_that(exception_wrapper.value.error_code).is_equal_to(
         ErrorCode.MESSAGE_INVALID)
Example #2
0
 def test_that_wrong_field_types_causes_message_validation_error(
         self, value_with_wrong_type):
     self.compute_task_def["extra_data"][
         value_with_wrong_type] = mock.sentinel.wrongtype
     with pytest.raises(ConcentValidationError) as exception_wrapper:
         validate_compute_task_def(self.compute_task_def)
     assert_that(exception_wrapper.value.error_message).contains(
         f"{value_with_wrong_type}")
     assert_that(exception_wrapper.value.error_code).is_equal_to(
         ErrorCode.MESSAGE_VALUE_NOT_STRING)
Example #3
0
 def test_that_valid_compute_task_def_doesnt_raise_any_exception(self):
     try:
         validate_compute_task_def(self.compute_task_def)
     except Exception as exception:  # pylint: disable=broad-except
         assert False, f"Unexpected exception has been raised: {str(exception)}"