예제 #1
0
    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"),
                ))),
            )
예제 #2
0
    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"),
                ))),
            )
예제 #3
0
    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"),
                ))),
            )
예제 #4
0
    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"),
                ))),
            )