def test_request_body(self): """ Can capture the request body. """ with self.graph.flask.test_request_context("/", data='{"foo": "bar"}'): request_info = RequestInfo(self.options, test_func, None) request_info.capture_request() dct = request_info.to_dict() assert_that( dct, is_(equal_to(dict( operation="test_func", method="GET", func="test_func", request_body=dict(foo="bar"), ))), )
def test_request_body_with_field_deletion(self): """ Can capture the request body with fields removed """ with self.graph.flask.test_request_context("/", data='{"foo": "bar", "this": "that"}'): g.hide_request_fields = ["foo"] request_info = RequestInfo(self.options, test_func, None) request_info.capture_request() dct = request_info.to_dict() assert_that( dct, is_(equal_to(dict( operation="test_func", method="GET", func="test_func", request_body=dict(this="that"), ))), )