Skip to content

Commit

Permalink
feat(test): add test with output schema for pivot database
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkerloch committed Mar 1, 2023
1 parent 448442e commit cd9310b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/config/sql2pivot.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"id": "pivot",
"type": "bdd",
"configFile": "{src_dir}/tests/config/pivot_base.json",
"schema": "pivot_schema"
"schema": "output"
}
],
"workingSpace": {
Expand Down
4 changes: 3 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()

Expand All @@ -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()
Expand Down

0 comments on commit cd9310b

Please sign in to comment.