graphql-engine/server/tests-py/test_v2_queries.py
Samir Talwar 5df8419a4f server/tests-py: Use markers for backends instead of parameterized tests.
I'm trying to shore up the Python integration tests to make them more reliable. In doing so, I noticed this.

---

It feels a lot more sensible as we never run on more than one backend at a time.

This also removes the `check_file_exists` parameter from the setup functions; it never worked. It was always set to the result of a comparison between a backend name and a function, which was always `False`. Enabling it breaks things.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5254
GitOrigin-RevId: 8718ab21527c2ba0a7205d1c01ebaac1a10be844
2022-08-02 19:33:59 +00:00

76 lines
2.7 KiB
Python

from validate import check_query_f
import pytest
usefixtures = pytest.mark.usefixtures
# use_mutation_fixtures = usefixtures(
# 'per_class_db_schema_for_mutation_tests',
# 'per_method_db_data_for_mutation_tests'
# )
@usefixtures('per_class_tests_db_state')
class TestV2SelectBasic: # Basic RQL Tests on v2/query
@classmethod
def dir(cls):
return 'queries/v2/basic'
def test_select_query_author(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/select_article.yaml')
def test_select_query_author_with_user_role_success(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/select_article_role_success.yaml')
# TODO: Fix this test for JWT
# def test_select_query_author_with_user_role_failure(self, hge_ctx):
# check_query_f(hge_ctx, self.dir() + '/select_article_role_error.yaml')
@pytest.mark.backend('mssql')
@usefixtures('per_class_tests_db_state')
class TestRunSQLMSSQL:
def test_drop_article_table_without_cascade(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/drop_article_table_without_cascade.yaml')
def test_drop_article_table_with_cascade(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/drop_article_table_with_cascade.yaml')
def test_create_author_table_fail(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/create_author_table_fail.yaml')
def test_invalid_sql_query(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/invalid_sql_query.yaml')
def test_select_query(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_select_query_mssql.yaml')
def test_drop_table(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_drop_table_mssql.yaml')
def test_rename_table(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_rename_table_mssql.yaml')
def test_drop_column(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_drop_column_mssql.yaml')
def test_add_column(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_add_column_mssql.yaml')
def test_rename_column(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_rename_column_mssql.yaml')
def test_select_query_fail(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_select_query_fail.yaml')
def test_add_column_fail(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_add_column_fail.yaml')
def test_drop_column_fail(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/sql_drop_column_fail.yaml')
def test_create_index_fail(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/create_index_fail.yaml')
@classmethod
def dir(cls):
return 'queries/v2/mssql/run_sql'