/
alt3rmann
/
graphql-engine
Обзор
Документация
Войти
/
alt3rmann
/
graphql-engine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
server/tests-py/test_pg_dump.py
34 строки
1 KB
Samir Talwar
CI: Test against PostgreSQL 16.
05 окт 2023, 15:59
05 окт 2023, 15:59
cca591a
Код
Авторство
О чём код?
import pytest from ruamel.yaml import YAML yaml=YAML(typ='safe', pure=True) @pytest.mark.usefixtures('per_method_tests_db_state') class TestPGDump: def test_pg_dump_for_public_schema(self, hge_ctx): query_file = self.dir() + '/pg_dump_public.yaml' with open(query_file, 'r') as stream: q = yaml.load(stream) headers = q['headers'] or {} if hge_ctx.hge_key is not None: headers['x-hasura-admin-secret'] = hge_ctx.hge_key response = hge_ctx.http.post(hge_ctx.hge_url + q['url'], json=q['query'], headers=headers) body = response.text assert response.status_code == q['status'], f'Response body: {body}' assert body == q['expected_response'], f'Response body: {body}' def test_pg_dump_for_public_schema_for_user_role(self, hge_ctx): query_file = self.dir() + '/pg_dump_public.yaml' with open(query_file, 'r') as stream: q = yaml.load(stream) headers = q['headers'] or {} if hge_ctx.hge_key is not None: headers['x-hasura-admin-secret'] = hge_ctx.hge_key headers['X-Hasura-Role'] = 'user' resp = hge_ctx.http.post(hge_ctx.hge_url + q['url'], json=q['query'], headers=headers) body = resp.text assert resp.status_code == 400, body @classmethod def dir(cls): return "pgdump"