From cd9310b1a280664c5a4e44d608ce9fba2d029512 Mon Sep 17 00:00:00 2001 From: jmkerloch Date: Wed, 1 Mar 2023 11:12:11 +0100 Subject: [PATCH] feat(test): add test with output schema for pivot database --- tests/config/sql2pivot.json | 2 +- tests/test_cli.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/config/sql2pivot.json b/tests/config/sql2pivot.json index f56bd8b..f769626 100644 --- a/tests/config/sql2pivot.json +++ b/tests/config/sql2pivot.json @@ -17,7 +17,7 @@ "id": "pivot", "type": "bdd", "configFile": "{src_dir}/tests/config/pivot_base.json", - "schema": "pivot_schema" + "schema": "output" } ], "workingSpace": { diff --git a/tests/test_cli.py b/tests/test_cli.py index f2b7d53..2ef181e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -27,6 +27,7 @@ # Schemas are defined in input configuration .json files INPUT_SCHEMA = "input" +OUTPUT_SCHEMA = "output" TRONCON_ROUTE_URL = "https://storage.gra.cloud.ovh.net/v1/AUTH_366279ce616242ebb14161b7991a8461/road2/troncon_route_marseille10.sql" NON_COMMUNICATION_URL = "https://storage.gra.cloud.ovh.net/v1/AUTH_366279ce616242ebb14161b7991a8461/road2/non_communication_marseille10.sql" @@ -37,8 +38,8 @@ def init_database(tmp_path) -> None: con = psycopg.connect(host=HOST, dbname=DBNAME, user=USER, password=PASS, port=PORT) con.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) - con.cursor().execute("CREATE DATABASE pivot") con.cursor().execute(f"CREATE SCHEMA IF NOT EXISTS {INPUT_SCHEMA}") + con.cursor().execute(f"CREATE DATABASE pivot") con.commit() con.close() @@ -60,6 +61,7 @@ def init_database(tmp_path) -> None: # Add extensions to pivot con = psycopg.connect(host=HOST, dbname="pivot", user=USER, password=PASS, port=PORT) + con.cursor().execute(f"CREATE SCHEMA IF NOT EXISTS {OUTPUT_SCHEMA}") con.cursor().execute("CREATE EXTENSION IF NOT EXISTS postgres_fdw") con.cursor().execute("CREATE EXTENSION IF NOT EXISTS Postgis") con.commit()