def hello(slf, request, request_id): Service.set_request_id(request, request_id) params = Service.get_json_params(request, ['who']) return {'hello': params['who']}
def test_get_json_params(self): req = FakeRequest(content=json.dumps({'foo': 'hello', 'bar': 'world'})) assert Service.get_json_params(req, ['foo'], ['bar', 'baz']) == { 'foo': 'hello', 'bar': 'world', }