Skip to content
Snippets Groups Projects
Commit e8f65ced authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed failed test cases.

parent cebf4c81
Branches
Tags
1 merge request!48v0.5.0 Release
......@@ -113,10 +113,7 @@ def mirror(
try:
upload = proc.Upload.get(upload_id)
if __in_test:
proc.Calc.objects(upload_id=upload_id).delete()
proc.Upload.objects(upload_id=upload_id).delete()
search.delete_upload(upload_id)
# In tests, we mirror from our selves, fake that the upload does not exist
raise KeyError()
if len(query) > 0:
......@@ -129,6 +126,12 @@ def mirror(
upload_data = client.mirror.get_upload_mirror(upload_id=upload_id).response().result
n_calcs = len(upload_data.calcs)
if __in_test:
# In tests, we mirror from our selves, remove it so it is not there for import
proc.Calc.objects(upload_id=upload_id).delete()
proc.Upload.objects(upload_id=upload_id).delete()
search.delete_upload(upload_id)
else:
n_calcs = 0
......
......@@ -135,6 +135,11 @@ class User(Base): # type: ignore
# TODO this has to change, e.g. trade for JWTs
token = ''.join(random.choices(User._token_chars, k=64))
session = Session(token=token, user=self)
# This will allow to add session to repo_db, even though it is already
# attached to a different repo_db SQL alchemy session. This happens during
# migration tests, where we mimic the use of two different postgres
# databases
session = repo_db.merge(session)
repo_db.add(session)
repo_db.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment