2021-10-06 10:15:14 +03:00
|
|
|
import pytest
|
|
|
|
import os
|
|
|
|
from validate import check_query_f, check_query, get_conf_f
|
|
|
|
from context import PytestConf
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("transport", ['http'])
|
|
|
|
@pytest.mark.usefixtures('per_class_tests_db_state')
|
|
|
|
class TestOpenAPISpec:
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/openapi'
|
|
|
|
|
|
|
|
def test_empty_openapi_json(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_empty.yaml', transport)
|
2021-10-14 13:31:21 +03:00
|
|
|
|
2021-10-06 10:15:14 +03:00
|
|
|
def test_endpoint_simple(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_get_endpoint_test_simple.yaml', transport)
|
2021-10-14 13:31:21 +03:00
|
|
|
|
2022-01-27 08:54:51 +03:00
|
|
|
def test_endpoint_with_aliases(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_endpoint_with_aliases.yaml', transport)
|
|
|
|
|
2021-10-06 10:15:14 +03:00
|
|
|
def test_endpoint_with_args(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_post_endpoint_test_with_args.yaml', transport)
|
2021-10-14 13:31:21 +03:00
|
|
|
|
2021-10-06 10:15:14 +03:00
|
|
|
def test_endpoint_with_args_url(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_post_endpoint_test_with_args_url.yaml', transport)
|
|
|
|
|
|
|
|
def test_endpoint_with_default_arg(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_post_endpoint_test_with_default_arg.yaml', transport)
|
2021-10-14 13:31:21 +03:00
|
|
|
|
2021-10-06 10:15:14 +03:00
|
|
|
def test_endpoint_with_multiple_methods(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_endpoint_with_multiple_methods.yaml', transport)
|
|
|
|
|
|
|
|
def test_multiple_endpoints(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_multiple_endpoints_test.yaml', transport)
|
2021-10-14 13:31:21 +03:00
|
|
|
|
|
|
|
def test_multiple_endpoints_same_path(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_multiple_endpoints_same_path.yaml', transport)
|
|
|
|
|
2022-01-25 09:27:49 +03:00
|
|
|
def test_multiple_endpoints_with_path_segments(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_multiple_endpoints_with_path_segments.yaml', transport)
|
|
|
|
|
2021-12-22 11:30:15 +03:00
|
|
|
def test_endpoint_with_complex_arg(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_get_endpoint_test_complex_arg.yaml', transport)
|
|
|
|
|
|
|
|
def test_endpoint_with_complex_args(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_get_endpoint_test_complex_args.yaml', transport)
|
|
|
|
|
|
|
|
def test_endpoint_with_recursive_arg(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_post_endpoint_test_recursive_arg.yaml', transport)
|
2022-01-21 08:39:08 +03:00
|
|
|
|
|
|
|
def test_duplicate_field_name(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/openapi_get_endpoint_test_duplicate_field_name.yaml', transport)
|