def GET(self, **query_params): request_url = cherrypy.url() try: response_json = to_json( self.get(request_url=request_url, query_params=query_params)) self._log_api_call("GET", request_url, response_json) return response_json except Exception as e: self.logger.exception(e) raise cherrypy.HTTPError(500, e)
def PUT(self, **query_params): request_url = cherrypy.url() request_json = cherrypy.request.json try: response_json = to_json( self.post(request_url=request_url, query_params=query_params, request_payload=request_json)) self._log_api_call("PUT", request_url, response_json, request_json) return response_json except Exception as e: self.logger.exception(e) raise cherrypy.HTTPError(500, e)
def test_should_serialize_and_deserialize_location_object(self): serialized_location = to_json(self.location) deserialized_location = from_json(serialized_location, Location) self.assertIsNotNone(deserialized_location) self.assertEqual(self.location, deserialized_location)
def test_should_serialize_location_object(self): serialized_location = to_json(self.location) self.assertIsNotNone(serialized_location)