How to use the scanapi.tree.RequestNode function in scanapi

To help you get started, we’ve selected a few scanapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_when_request_has_no_method(self):
            request = RequestNode(
                {"name": "foo", "path": "http:foo.com"},
                endpoint=EndpointNode({"name": "foo", "requests": [{}]}),
            )
            assert request.http_method == "GET"
github camilamaia / scanapi / tests / unit / tree / test_testing_node.py View on Github external
def testing_node(self):
            __test__ = False
            endpoint_node = EndpointNode(spec={"name": "foo"})
            request_node = RequestNode(spec={"name": "bar"}, endpoint=endpoint_node)
            spec = {
                "name": "status_is_200",
                "assert": "${{ response.status_code == 200 }}",
            }
            return TestingNode(spec=spec, request=request_node)
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_calls_evaluate(self, mocker, mock_evaluate):
            endpoint = EndpointNode(
                {"params": {"abc": "def"}, "name": "foo", "requests": [{}]}
            )

            request = RequestNode(
                {"params": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo"},
                endpoint=endpoint,
            )
            request.params
            calls = [mocker.call({"abc": "def", "ghi": "jkl"})]

            mock_evaluate.assert_has_calls(calls)
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_when_endpoint_has_headers(self):
            headers = {"abc": "def"}
            endpoint_headers = {"xxx": "www"}
            request = RequestNode(
                {"headers": headers, "path": "http://foo.com", "name": "foo"},
                endpoint=EndpointNode(
                    {"headers": endpoint_headers, "name": "foo", "requests": [{}]}
                ),
            )
            assert request.headers == {"abc": "def", "xxx": "www"}
github camilamaia / scanapi / tests / unit / tree / test_testing_node.py View on Github external
def test_full_name(self):
            endpoint_node = EndpointNode({"name": "foo"})
            request_node = RequestNode(spec={"name": "bar"}, endpoint=endpoint_node)
            test_node = TestingNode(
                spec={"name": "lol", "assert": "okay"}, request=request_node
            )

            assert test_node.full_name == "foo::bar::lol"
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_when_request_has_no_body(self):
            request = RequestNode(
                {"path": "http://foo.com", "name": "foo"},
                endpoint=EndpointNode({"name": "foo", "requests": [{}]}),
            )
            assert request.body == {}
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_when_endpoint_has_no_headers(self):
            headers = {"abc": "def"}
            request = RequestNode(
                {"headers": headers, "path": "http://foo.com", "name": "foo"},
                endpoint=EndpointNode({"name": "foo", "requests": [{}]}),
            )
            assert request.headers == headers
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_calls_evaluate(self, mocker, mock_evaluate):
            endpoint = EndpointNode(
                {"name": "foo", "requests": [{}], "path": "http://foo.com/"}
            )
            request = RequestNode({"path": "/foo/", "name": "foo"}, endpoint=endpoint)
            request.full_url_path
            calls = [mocker.call("http://foo.com/"), mocker.call("/foo/")]

            mock_evaluate.assert_has_calls(calls)
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_calls_evaluate(self, mocker, mock_evaluate):
            request = RequestNode(
                {"body": {"ghi": "jkl"}, "path": "http://foo.com", "name": "foo"},
                endpoint=EndpointNode({"name": "foo", "requests": [{}]}),
            )
            request.body
            calls = [mocker.call({"ghi": "jkl"})]

            mock_evaluate.assert_has_calls(calls)
github camilamaia / scanapi / tests / unit / tree / test_request_node.py View on Github external
def test_when_endpoint_has_no_url(self):
            path = "http://foo.com"
            request = RequestNode(
                {"name": "foo", "path": path},
                endpoint=EndpointNode({"name": "foo", "requests": [{}], "path": ""}),
            )
            assert request.full_url_path == path