def test_no_params_filter(self): """Tests that params are completely filtered.""" params_superset = filter_params(self.function_no_params, self.params_superset) params = filter_params(self.function_no_params, self.params) params_subset = filter_params(self.function_no_params, self.params_subset) assert params_superset == {} assert params == {} assert params_subset == {}
async def wrapper(request: Request) -> JSONResponse: asyncio.ensure_future(log_request(request, route, function)) try: # Get the body body = await get_body(request) # Get params and headers params = filter_params(function, body) headers = request.headers if not callback: # Process and return the result return JSONResponse( await generic_call(function, params), status_code=response_code, ) return callback_client.handle_callback(headers, params) except Exception as error: return handle_error(error)
def test_params_filter(self): """Tests that params don't change once filtered.""" params = filter_params(self.function, self.params) assert params == self.params
def test_params_superset_filter(self): """Tests that the params shrink to just the ones of the function.""" params = filter_params(self.function, self.params_superset) assert params == {"x": 5, "y": 6, "z": 7}
def test_params_subset_kwargs_filter(self): """Tests that params don't change once filtered.""" params = filter_params(self.function_kwargs, self.params_subset) assert params == self.params_subset
def test_params_subset_filter(self): """Tests that the params shrink to just the ones present on the function.""" params = filter_params(self.function, self.params_subset) assert params == {"x": 1, "y": 2}