2018-09-18 09:21:57 +03:00
|
|
|
import yaml
|
2019-04-08 10:22:38 +03:00
|
|
|
import pytest
|
2018-09-18 09:21:57 +03:00
|
|
|
from validate import check_query_f
|
2018-10-28 21:27:49 +03:00
|
|
|
from super_classes import DefaultTestSelectQueries
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryBasic(DefaultTestSelectQueries):
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_author(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_author.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_various_postgres_types(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_test_types.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_author_quoted_col(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_author_col_quoted.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_author_pk(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_author_by_pkey.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_where(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_author_where.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_nested_select_query_article_author(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/nested_select_query_article_author.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_nested_select_query_deep(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/nested_select_query_deep.yaml', transport)
|
2018-10-12 12:28:43 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_nested_select_query_where(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/nested_select_where_query_author_article.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_nested_select_query_where_on_relationship(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/nested_select_query_article_author_where_on_relationship.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_user(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/select_query_user.yaml", transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_non_tracked_table(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/select_query_non_tracked_table_err.yaml", transport)
|
2018-10-05 08:16:21 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_select_query_col_not_present_err(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/select_query_author_col_not_present_err.yaml", transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2019-05-02 15:31:32 +03:00
|
|
|
def test_select_query_user_col_change(self, hge_ctx, transport):
|
2019-05-10 09:05:11 +03:00
|
|
|
check_query_f(hge_ctx, self.dir() + "/select_query_user_col_change.yaml")
|
2019-05-02 15:31:32 +03:00
|
|
|
|
2019-06-03 13:21:55 +03:00
|
|
|
def test_nested_select_with_foreign_key_alter(self, hge_ctx, transport):
|
|
|
|
transport = 'http'
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/nested_select_with_foreign_key_alter.yaml", transport)
|
2019-08-08 23:57:42 +03:00
|
|
|
|
|
|
|
def test_select_query_invalid_escape_sequence(self, hge_ctx, transport):
|
|
|
|
transport = 'http'
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/select_query_invalid_escape_sequence.yaml", transport)
|
2019-06-03 13:21:55 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/basic'
|
|
|
|
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryAgg(DefaultTestSelectQueries):
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_agg_count_sum_avg_max_min_with_aliases(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/article_agg_count_sum_avg_max_min_with_aliases.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_agg_where(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/article_agg_where.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_agg_with_articles(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author_agg_with_articles.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_agg_with_articles_where(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author_agg_with_articles_where.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_deeply_nested_aggregate(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/article_deeply_nested_aggregate.yaml', transport)
|
2018-11-12 10:28:46 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/aggregations'
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryAggPerm(DefaultTestSelectQueries):
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_agg_articles(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author_agg_articles.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_agg_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/article_agg_fail.yaml', transport)
|
2018-10-26 12:02:44 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_articles_agg_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author_articles_agg_fail.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-08-01 08:09:52 +03:00
|
|
|
def test_author_post_agg_order_by(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author_post_agg_order_by.yaml', transport)
|
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/agg_perm'
|
2018-10-26 12:02:44 +03:00
|
|
|
|
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryLimits(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_limit_1(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_limit_1.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_limit_2(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_limit_2.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2018-11-27 15:24:51 +03:00
|
|
|
def test_limit_null(self, hge_ctx):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_limit_null.yaml')
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_err_str_limit_error(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_string_limit_error.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_err_neg_limit_error(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_neg_limit_error.yaml', transport)
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/limits'
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
|
|
|
|
class TestGraphQLQueryOffsets(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_offset_1_limit_2(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_offset_1_limit_2.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_offset_2_limit_1(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_offset_2_limit_1.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_int_as_string_offset(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_string_offset.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
|
|
|
def test_err_neg_offset_error(self, hge_ctx):
|
2018-10-28 21:27:49 +03:00
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_article_neg_offset_error.yaml')
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/offset'
|
2018-09-18 09:21:57 +03:00
|
|
|
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryBoolExpBasic(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_not_equal(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_neq.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_operator_ne_not_found_err(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_operator_ne_not_found_err.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_greater_than(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_gt.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_greater_than_or_equal(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_gte.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_less_than(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_lt.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_less_than_or_equal(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_lte.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_in(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_in.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_in_empty_array(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_in_empty_array.yaml', transport)
|
2018-11-21 09:58:29 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_nin_empty_array(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_nin_empty_array.yaml', transport)
|
2018-11-21 09:58:29 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_nin(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_nin.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_uuid_test_in_uuid_col(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_uuid_test_in_uuid_col.yaml', transport)
|
2018-11-26 13:09:55 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_order_delivered_at_is_null(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_order_delivered_at_is_null.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_order_delivered_at_is_not_null(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_query_order_delivered_at_is_not_null.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_author_article_where_not_less_than(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_where_not_lt.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_author_is_published_and_registered(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_article_author_is_published_and_registered.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_author_not_published_nor_registered(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_article_author_not_published_or_not_registered.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_article_author_unexpected_operator_in_where_err(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_unexpected_operator_in_where_err.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_self_referential_relationships(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/self_referential_relationships.yaml', transport)
|
2018-11-16 15:40:23 +03:00
|
|
|
|
2019-09-05 10:34:53 +03:00
|
|
|
def test_query_account_permission_success(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_account_permission_success.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_account_permission_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_account_permission_fail.yaml', transport)
|
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/boolexp/basic'
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphqlQueryPermissions(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_select_unpublished_articles(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_select_query_unpublished_articles.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_only_other_users_published_articles(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_can_query_other_users_published_articles.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_anonymous_only_published_articles(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/anonymous_can_only_get_published_articles.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_cannot_access_remarks_col(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_cannot_access_remarks_col.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_can_query_geometry_values_filter(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_can_query_geometry_values_filter.yaml', transport)
|
2019-01-28 20:46:31 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_can_query_geometry_values_filter_session_vars(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_can_query_geometry_values_filter_session_vars.yaml', transport)
|
2019-01-28 20:46:31 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_can_query_jsonb_values_filter(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_can_query_jsonb_values_filter.yaml', transport)
|
2019-01-28 20:46:31 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_user_can_query_jsonb_values_filter_session_vars(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_can_query_jsonb_values_filter_session_vars.yaml', transport)
|
2019-01-28 20:46:31 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_artist_select_query_Track_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/artist_select_query_Track_fail.yaml', transport)
|
2018-11-02 12:36:33 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_artist_select_query_Track(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/artist_select_query_Track.yaml', transport)
|
2018-11-02 12:36:33 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_artist_search_tracks(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/artist_search_tracks.yaml', transport)
|
2019-01-25 06:31:54 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_artist_search_tracks_aggregate(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/artist_search_tracks_aggregate.yaml', transport)
|
2019-01-25 06:31:54 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_staff_passed_students(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/staff_passed_students.yaml', transport)
|
2019-02-22 13:27:38 +03:00
|
|
|
|
2019-04-24 13:28:10 +03:00
|
|
|
def test_user_query_auction(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/user_query_auction.yaml', transport)
|
|
|
|
|
2019-10-02 09:36:27 +03:00
|
|
|
@pytest.mark.xfail(reason="Refer https://github.com/hasura/graphql-engine-internal/issues/252")
|
2019-07-10 13:19:58 +03:00
|
|
|
def test_jsonb_has_all(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/jsonb_has_all.yaml', transport)
|
|
|
|
|
|
|
|
def test_jsonb_has_any(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/jsonb_has_any.yaml', transport)
|
|
|
|
|
|
|
|
def test_in_and_nin(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/in_and_nin.yaml', transport)
|
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/permissions'
|
2018-10-04 15:44:15 +03:00
|
|
|
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryBoolExpSearch(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_like(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_like.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_not_like(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_nlike.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_ilike(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_ilike.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_not_ilike(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_nilike.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_similar(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_similar.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_city_where_not_similar(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_city_where_not_similar.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/boolexp/search'
|
2018-10-04 15:44:15 +03:00
|
|
|
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryBoolExpJsonB(DefaultTestSelectQueries):
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_contains_article_latest(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_article_author_jsonb_contains_latest.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_contains_article_beststeller(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_author_article_jsonb_contains_bestseller.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_contained_in_latest(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_article_author_jsonb_contained_in_latest.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_contained_in_bestseller_latest(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_article_author_jsonb_contained_in_bestseller_latest.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_has_key_sim_type(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_product_jsonb_has_key_sim_type.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_has_keys_any_os_operating_system(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_product_jsonb_has_keys_any_os_operating_system.yaml', transport)
|
2018-10-04 15:44:15 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_jsonb_has_keys_all_touchscreen_ram(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_product_jsonb_has_keys_all_ram_touchscreen.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/boolexp/jsonb'
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-01-17 09:21:38 +03:00
|
|
|
class TestGraphQLQueryBoolExpPostGIS(DefaultTestSelectQueries):
|
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_query_using_point(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_using_point.yaml', transport)
|
2019-01-17 09:21:38 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_query_using_line(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_using_line.yaml', transport)
|
2019-01-17 09:21:38 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_query_using_polygon(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_using_polygon.yaml', transport)
|
2019-01-17 09:21:38 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_query_geography_spatial_ops(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_geography_spatial_ops.yaml', transport)
|
2019-03-25 15:29:52 +03:00
|
|
|
|
2019-07-15 11:52:45 +03:00
|
|
|
def test_query_cast_geometry_to_geography(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_cast_geometry_to_geography.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_cast_geography_to_geometry(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_cast_geography_to_geometry.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_illegal_cast_is_not_allowed(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_illegal_cast_is_not_allowed.yaml', transport)
|
|
|
|
|
2019-01-17 09:21:38 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/boolexp/postgis'
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-08-29 16:07:05 +03:00
|
|
|
class TestGraphQLQueryBoolExpRaster(DefaultTestSelectQueries):
|
|
|
|
|
|
|
|
def test_query_st_intersects_geom_nband(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_st_intersects_geom_nband.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_st_intersects_geom_nband_no_rows(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_st_intersects_geom_nband_no_rows.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_st_intersects_rast(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_st_intersects_rast.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_st_intersects_rast_no_rows(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_st_intersects_rast_no_rows.yaml', transport)
|
|
|
|
|
|
|
|
def test_query_st_intersects_rast_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_st_intersects_rast_fail.yaml', transport)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/boolexp/raster'
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2018-10-28 21:27:49 +03:00
|
|
|
class TestGraphQLQueryOrderBy(DefaultTestSelectQueries):
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_articles_order_by_without_id(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/articles_order_by_without_id.yaml', transport)
|
2018-10-26 14:57:33 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_articles_order_by_rel_author_id(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/articles_order_by_rel_author_id.yaml', transport)
|
2018-10-26 14:57:33 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_articles_order_by_rel_author_rel_contact_phone(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/articles_order_by_rel_author_rel_contact_phone.yaml', transport)
|
2018-10-28 21:27:49 +03:00
|
|
|
|
2019-08-22 11:14:27 +03:00
|
|
|
def test_articles_order_by_null(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/articles_order_by_null.yaml', transport)
|
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_album_order_by_tracks_count(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/album_order_by_tracks_count.yaml', transport)
|
2018-12-12 15:58:39 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_album_order_by_tracks_duration_avg(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/album_order_by_tracks_duration_avg.yaml', transport)
|
2018-12-12 15:58:39 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_album_order_by_tracks_max_name(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/album_order_by_tracks_max_name.yaml', transport)
|
2018-12-12 15:58:39 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_album_order_by_tracks_bytes_stddev(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/album_order_by_tracks_bytes_stddev.yaml', transport)
|
2018-12-12 15:58:39 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_employee_distinct_department_order_by_salary_desc(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/employee_distinct_department_order_by_salary_desc.yaml', transport)
|
2018-11-23 04:53:56 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_employee_distinct_department_order_by_salary_asc(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/employee_distinct_department_order_by_salary_asc.yaml', transport)
|
2018-11-23 04:53:56 +03:00
|
|
|
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_employee_distinct_fail(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/employee_distinct_fail.yaml', transport)
|
2018-11-23 04:53:56 +03:00
|
|
|
|
2019-10-05 07:00:53 +03:00
|
|
|
def test_album_order_by_tracks_tags(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/album_order_by_tracks_tags.yaml', transport)
|
|
|
|
|
2018-10-28 21:27:49 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/order_by'
|
2019-01-25 06:31:54 +03:00
|
|
|
|
|
|
|
class TestGraphQLQueryFunctions(DefaultTestSelectQueries):
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_search_posts(self, hge_ctx, transport):
|
2019-01-25 06:31:54 +03:00
|
|
|
check_query_f(hge_ctx, self.dir() + "/query_search_posts.yaml")
|
|
|
|
|
2019-05-10 09:05:11 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
2019-04-08 10:22:38 +03:00
|
|
|
def test_search_posts_aggregate(self, hge_ctx, transport):
|
2019-01-25 06:31:54 +03:00
|
|
|
check_query_f(hge_ctx, self.dir() + "/query_search_posts_aggregate.yaml")
|
|
|
|
|
2019-08-28 22:27:15 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
|
|
|
def test_query_get_users(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/query_get_users.yaml", transport)
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
|
|
|
def test_query_get_users_arguments_error(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/query_get_users_arguments_error.yaml", transport)
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
|
|
|
def test_query_get_users_default_arguments_error(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + "/query_get_users_default_arguments_error.yaml", transport)
|
|
|
|
|
2019-02-05 08:57:03 +03:00
|
|
|
def test_alter_function_error(self, hge_ctx):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/alter_function_error.yaml')
|
|
|
|
|
2019-02-14 07:05:18 +03:00
|
|
|
def test_overloading_function_error(self, hge_ctx):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/overloading_function_error.yaml')
|
|
|
|
|
2019-04-08 09:58:56 +03:00
|
|
|
def test_query_get_test_uuid(self, hge_ctx):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_get_test_uuid.yaml')
|
|
|
|
|
2019-06-04 15:43:28 +03:00
|
|
|
def test_query_my_add(self, hge_ctx):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/query_my_add.yaml')
|
|
|
|
|
2019-01-25 06:31:54 +03:00
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/functions'
|
2019-07-22 15:47:13 +03:00
|
|
|
|
2019-09-19 07:47:36 +03:00
|
|
|
@pytest.mark.parametrize("transport", ['http', 'websocket'])
|
|
|
|
class TestGraphQLQueryCustomSchema(DefaultTestSelectQueries):
|
|
|
|
|
|
|
|
def test_author(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/author.yaml', transport)
|
|
|
|
|
|
|
|
def test_article(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/article.yaml', transport)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/custom_schema'
|
|
|
|
|
2019-07-22 15:47:13 +03:00
|
|
|
@pytest.mark.parametrize('transport', ['http', 'websocket'])
|
|
|
|
class TestGraphQLQueryEnums(DefaultTestSelectQueries):
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/enums'
|
|
|
|
|
|
|
|
def test_introspect(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/introspect.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_enum_field(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_enum_field.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_where_enum_eq(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_where_enum_eq_bad_value(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq_bad_value.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_where_enum_eq_string(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq_string.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_where_enum_eq_variable(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq_variable.yaml', transport)
|
|
|
|
|
|
|
|
def test_select_where_enum_eq_variable_bad_value(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq_variable_bad_value.yaml', transport)
|
2019-10-11 05:22:16 +03:00
|
|
|
|
|
|
|
def test_select_where_enum_eq_without_enum_table_visibility(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/select_where_enum_eq_without_enum_table_visibility.yaml', transport)
|
2019-10-16 17:33:34 +03:00
|
|
|
|
2019-10-18 11:29:47 +03:00
|
|
|
@pytest.mark.parametrize('transport', ['http', 'websocket'])
|
|
|
|
class TestGraphQLQueryComputedFields(DefaultTestSelectQueries):
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/computed_fields'
|
|
|
|
|
|
|
|
def test_computed_fields(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/computed_fields.yaml', transport)
|
|
|
|
|
|
|
|
def test_computed_fields_permission(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/computed_fields_permission.yaml', transport)
|
|
|
|
|
2019-10-16 17:33:34 +03:00
|
|
|
@pytest.mark.parametrize('transport', ['http', 'websocket'])
|
|
|
|
class TestGraphQLQueryCaching(DefaultTestSelectQueries):
|
|
|
|
@classmethod
|
|
|
|
def dir(cls):
|
|
|
|
return 'queries/graphql_query/caching'
|
|
|
|
|
|
|
|
def test_include_directive(self, hge_ctx, transport):
|
|
|
|
check_query_f(hge_ctx, self.dir() + '/include_directive.yaml', transport)
|