def test_response_json_paths_fail_path(self): handler = handlers.JSONResponseHandler(self.test_class) self.test.test_data = { 'response_json_paths': { '$.objects[1].name': 'cow', } } self.test.json_data = { 'objects': [{ 'name': 'cow', 'location': 'barn' }, { 'name': 'chris', 'location': 'house' }] } with self.assertRaises(AssertionError): self._assert_handler(handler)
def test_response_json_paths(self): handler = handlers.JSONResponseHandler(self.test_class) self.test.test_data = { 'response_json_paths': { '$.objects[0].name': 'cow', '$.objects[1].location': 'house', } } self.test.json_data = { 'objects': [{ 'name': 'cow', 'location': 'barn' }, { 'name': 'chris', 'location': 'house' }] } self._assert_handler(handler)