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" )
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")
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")
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")
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")