graphql-engine/server/tests-py/test_pg_dump.py
Samir Talwar cca591a7f9 CI: Test against PostgreSQL 16.
This changes our test configuration to use the PostgreSQL 16 image from `postgis/postgis`.

In addition, it bumps PostGIS to v3.4 (from v3.3).

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10361
GitOrigin-RevId: 883c96d8453efb42b226f849891488382a99c80c
2023-10-05 12:59:17 +00:00

35 lines
1.4 KiB
Python

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"