1
0
mirror of https://github.com/hasura/graphql-engine.git synced 2024-12-16 01:44:03 +03:00
graphql-engine/server/tests-py/test_remote_schema_prioritize_data.py
paritosh-08 7f1f0606ed add config to prioritize data/error for remote schema fields
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10528
Co-authored-by: Rob Dominguez <24390149+robertjdominguez@users.noreply.github.com>
GitOrigin-RevId: 49d0d7cbcc73fb0876d7ac3f5a1a8ff61ff800e8
2023-12-19 13:30:30 +00:00

45 lines
1.4 KiB
Python

#!/usr/bin/env python3
import pytest
from conftest import extract_server_address_from
from remote_server import NodeGraphQL
from validate import check_query_f
pytestmark = [
pytest.mark.admin_secret,
pytest.mark.hge_env('HASURA_GRAPHQL_REMOTE_SCHEMA_PRIORITIZE_DATA', 'true'),
]
@pytest.fixture(scope='class')
@pytest.mark.early
def fake_graphql_service(worker_id: str, hge_fixture_env: dict[str, str]):
(_, port) = extract_server_address_from('GRAPHQL_SERVICE')
server = NodeGraphQL(worker_id, 'remote_schemas/nodejs/returns_data_and_errors.js', port=port)
server.start()
print(f'{fake_graphql_service.__name__} server started on {server.url}')
hge_fixture_env['GRAPHQL_SERVICE'] = server.url
yield server
server.stop()
use_test_fixtures = pytest.mark.usefixtures(
'fake_graphql_service',
'per_method_tests_db_state',
)
@use_test_fixtures
class TestRemoteSchemaPrioritizeData:
@classmethod
def dir(cls):
return "queries/remote_schemas/validate_data_errors_prioritization/"
def test_data_only_query(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + 'data_prioritization/test_data_only_query.yaml')
def test_error_only_query(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + 'data_prioritization/test_error_only_query.yaml')
def test_data_and_errors_query(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + 'data_prioritization/test_data_and_errors_query.yaml')