Ejemplo n.º 1
0
 def test_message_that_breaks_validation_rule_returns_problematic_attribute_name(
         self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/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']
Ejemplo n.º 2
0
 def test_sample_data_event_issuance_fails_validation_with_null_section_desc(
         self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/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
Ejemplo n.º 3
0
 def test_message_without_an_event_type_fails_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/vt_payment.json')
     del sample_data['event_type']
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Ejemplo n.º 4
0
 def test_unknown_event_type_fails_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/vt_payment.json')
     sample_data['event_type'] = 'unknown_event'
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is False
Ejemplo n.º 5
0
 def test_sample_data_vt_dispute_finding_passes_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/vt_dispute_finding.json')
     assert type(sample_data) is dict
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is True
Ejemplo n.º 6
0
 def test_sample_data_event_issuance_passes_validation(self):
     sample_data = self.get_sample_data(
         'python/tests/sample_data/event_issuance.json')
     assert type(sample_data) is dict
     validate_class = Validate(Config())
     assert validate_class.validate(sample_data)['isSuccess'] is True
Ejemplo n.º 7
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
Ejemplo n.º 8
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