mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
0ffb0478b9
* 1) Tests for creating permissions 2) Test for constraint_on with GraphQL insert on_conflict * Run tests with access key and webhook * Tests for GraphQL query with quoted columns * Rewrite test-server.sh so that it can be run locally * JWT based tests * Tests with various postgres types * For tests on select queries, run setup only once per class * Tests for v1 count queries * Skip teardown for tests that does not modify data * Workaround for hpc 'parse error when reading .tix file' * Move GeoJson tests to the new structure * Basic tests for v1 queries * Tests for column, table or operator not found error cases on GraphQL queries * Skip test teardown for mutation tests which does not change database state, even when it returns 200.
46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
import pytest
|
|
from abc import ABC, abstractmethod
|
|
|
|
class DefaultTestQueries(ABC):
|
|
|
|
def do_setup(self, setup_ctrl, hge_ctx):
|
|
if not setup_ctrl['setupDone']:
|
|
st_code, resp = hge_ctx.v1q_f(self.dir() + '/setup.yaml')
|
|
assert st_code == 200, resp
|
|
setup_ctrl['setupDone'] = True
|
|
|
|
def do_teardown(self, setup_ctrl, hge_ctx):
|
|
if setup_ctrl['setupDone'] and not hge_ctx.may_skip_test_teardown:
|
|
st_code, resp = hge_ctx.v1q_f(self.dir() + '/teardown.yaml')
|
|
assert st_code == 200, resp
|
|
setup_ctrl['setupDone'] = False
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def transact(self, setup_ctrl, hge_ctx):
|
|
self.do_setup(setup_ctrl, hge_ctx)
|
|
yield
|
|
self.do_teardown(setup_ctrl, hge_ctx);
|
|
|
|
@abstractmethod
|
|
def dir(self):
|
|
pass
|
|
|
|
|
|
class DefaultTestSelectQueries(ABC):
|
|
|
|
@pytest.fixture(scope='class')
|
|
def transact(self, request, hge_ctx):
|
|
st_code, resp = hge_ctx.v1q_f(self.dir() + '/setup.yaml')
|
|
assert st_code == 200, resp
|
|
yield
|
|
st_code, resp = hge_ctx.v1q_f(self.dir() + '/teardown.yaml')
|
|
assert st_code == 200, resp
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def ensure_transact(self, transact):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def dir(self):
|
|
pass
|