mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
0a3fd16c35
https://github.com/hasura/graphql-engine-mono/pull/1972 GitOrigin-RevId: cb062df7a1ba1c99705f811409e2e4ad42f4b581
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
#!/usrbin/env python3
|
|
|
|
import pytest
|
|
from validate import check_query_f
|
|
from context import PytestConf
|
|
|
|
usefixtures = pytest.mark.usefixtures
|
|
|
|
if not PytestConf.config.getoption("--test-allowlist-queries"):
|
|
pytest.skip("flag --test-allowlist-queries is not set. Cannot runt tests for allowlist queries", allow_module_level=True)
|
|
|
|
@pytest.mark.parametrize("transport", ['http','websocket'])
|
|
@usefixtures('per_class_tests_db_state')
|
|
class TestAllowlistQueries:
|
|
|
|
def test_query_user(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/query_user.yaml', transport)
|
|
|
|
def test_query_user_by_pk(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/query_user_by_pk.yaml', transport)
|
|
|
|
def test_query_user_with_typename(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/query_user_with_typename.yaml', transport)
|
|
|
|
def test_query_non_allowlist(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/query_non_allowlist.yaml', transport)
|
|
|
|
def test_query_as_admin(self, hge_ctx, transport):
|
|
check_query_f(hge_ctx, self.dir() + '/query_as_admin.yaml', transport)
|
|
|
|
def test_update_query(self, hge_ctx, transport):
|
|
# test only for http
|
|
transport = 'http'
|
|
check_query_f(hge_ctx, self.dir() + '/update_query.yaml', transport)
|
|
check_query_f(hge_ctx, self.dir() + '/add_duplicate_query.yaml')
|
|
|
|
@classmethod
|
|
def dir(cls):
|
|
return 'queries/graphql_query/allowlist'
|