Beispiel #1
0
 def test_message_that_breaks_validation_rule_returns_problematic_attribute_name(
         self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/etk/vt_payment.json')
     sample_data['event_id'] = "1234"  # string instead of integer
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
     assert 'event_id' in validate_class.validate(
         sample_data)['description']
Beispiel #2
0
 def test_sample_data_vt_dispute_status_update_passes_validation(self):
     sample_data = self.get_sample_data(
         'python/common/tests/sample_data/etk/vt_dispute_status_update.json'
     )
     assert type(sample_data) is dict
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is True
Beispiel #3
0
 def test_sample_data_event_issuance_fails_validation_with_null_section_desc(
         self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/etk/event_issuance.json')
     assert type(sample_data) is dict
     sample_data['evt_issuance']['counts'][0]['section_desc'] = None
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Beispiel #4
0
 def test_sample_data_event_issuance_passes_validation_with_empty_section_desc(
         self):
     sample_data = self.get_sample_data(
         'python/common/tests/sample_data/etk/event_issuance.json')
     assert type(sample_data) is dict
     sample_data['evt_issuance']['counts'][0]['section_desc'] = ''
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is True
Beispiel #5
0
 def test_message_without_an_event_type_fails_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/etk/vt_payment.json')
     del sample_data['event_type']
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Beispiel #6
0
 def test_unknown_event_type_fails_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/etk/vt_payment.json')
     sample_data['event_type'] = 'unknown_event'
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Beispiel #7
0
 def test_sample_data_event_issuance_passes_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/etk/event_issuance.json')
     assert type(sample_data) is dict
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is True
Beispiel #8
0
 def test_a_test_message_with_bad_json_fails_validation():
     sample_data = 'some string that is not json or does not decode into a dictionary'
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Beispiel #9
0
 def test_a_null_test_message_fails_validation():
     sample_data = None
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False