Commit bc365373 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix repair repository db issues after reset.

parent 0600823c
Pipeline #41241 failed with stages
in 15 minutes and 10 seconds
......@@ -270,6 +270,7 @@ def repository_db_connection(dbname=None, with_trans=True):
def reset_repository_db():
""" Drops the existing NOMAD-coe repository postgres schema and creates a new minimal one. """
old_repository_db = repository_db
if repository_db is not None:
......@@ -289,6 +290,6 @@ def reset_repository_db():'(re-)created repository db postgres schema')
# try tp repair existing db connections
old_db = repository_db
old_db.bind = repository_db_conn
if old_repository_db is not None:
old_repository_db.bind = repository_db_conn
......@@ -117,18 +117,6 @@ def repository_db(monkeysession):
def repair_repository_db():
Binds a new connectino to the existing session repository db.
Necessary if tests delete the connection.
yield None
olddb = infrastructure.repository_db
olddb.bind = infrastructure.repository_db_conn
def test_user(repository_db):
return coe_repo.ensure_test_user(email='')
......@@ -84,13 +84,13 @@ class TestAdmin:
return create_auth_headers(admin_user)
def test_reset(self, client, admin_user_auth, repair_repository_db):
def test_reset(self, client, admin_user_auth, repository_db):
rv ='/admin/reset', headers=admin_user_auth)
assert rv.status_code == 200
# TODO disabled as this will destroy the session repository_db beyond repair.
# @pytest.mark.timeout(10)
# def test_remove(self, client, admin_user_auth, repair_repository_db):
# def test_remove(self, client, admin_user_auth, repository_db):
# rv ='/admin/remove', headers=admin_user_auth)
# assert rv.status_code == 200
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment