Пример #1
0
 def test_validate_json(self):
     """
     Test JSON correctness
     """
     json_string = {'userName': '******', 'age': 10, 'name': 'name3', 'surname': 'surname3'}
     result = userservice.validate_json(json_string)
     self.assertEqual(result , "user has been saved" )
Пример #2
0
 def test_validate_json_negative_age(self):
     """
     Test JSON correctness with misspelled age
     """
     json_string = {'userName': '******', 'age': -1, 'name': 'name3', 'surname': 'surname3'}
     result = userservice.validate_json(json_string)
     self.assertEqual(result, "incorrect age")
Пример #3
0
 def test_validate_json_void_name(self):
     """
     Test JSON correctness with misspelled name
     """
     json_string = {'userName': '******', 'age': 10, 'name' : '', 'surname': 'surname3'}
     result = userservice.validate_json(json_string)
     self.assertEqual(result, "void field name")
Пример #4
0
 def test_validate_json_wrong_age(self):
     """
     Test JSON correctness with misspelled age
     """
     json_string = {'userName': '******', 'ae': 10, 'name': 'name3', 'surname': 'surname3'}
     result = userservice.validate_json(json_string)
     self.assertEqual(result, "age in json file")
Пример #5
0
 def test_validate_json_missing_username(self):
     """
     Test JSON correctness with misspelled username
     """
     json_string = { 'age': 10, 'name': 'name3', 'surname': 'surname3'}
     result = userservice.validate_json(json_string)
     self.assertEqual(result, "userName in json file")