Пример #1
0
    def test_parse_request_form_body_no_data(self):
        body = oai.RequestBody.construct(content={})

        from openapi_python_client.parser.openapi import Endpoint

        result = Endpoint.parse_request_form_body(body)

        assert result is None
Пример #2
0
    def test_parse_request_form_body(self, mocker):
        ref = mocker.MagicMock()
        body = oai.RequestBody.construct(
            content={
                "application/x-www-form-urlencoded":
                oai.MediaType.construct(
                    media_type_schema=oai.Reference.construct(ref=ref))
            })
        from_ref = mocker.patch(f"{MODULE_NAME}.Reference.from_ref")

        from openapi_python_client.parser.openapi import Endpoint

        result = Endpoint.parse_request_form_body(body)

        from_ref.assert_called_once_with(ref)
        assert result == from_ref()