Skip to content

Commit

Permalink
Remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn committed Aug 2, 2024
1 parent 7b11b7a commit c57d3c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
17 changes: 8 additions & 9 deletions tests/scripts/create_test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
"archive",
]

USER_TOKENS = {
"admin": "1b9436200001f2eaf57cd77db075cbb60a49a00a",
"readerstudy": "01614a77b1c0b4ecd402be50a8ff96188d5b011d",
"demop": "00aa710f4dc5621a0cb64b0795fbba02e39d7700",
"archive": "0d284528953157759d26c469297afcf6fd367f71",
}


def run():
"""Creates the main project, demo user and demo challenge."""
Expand Down Expand Up @@ -294,16 +301,8 @@ def _create_archive(users):


def _create_user_tokens(users):
# Hard code tokens used in gcapi integration tests
user_tokens = {
"admin": "1b9436200001f2eaf57cd77db075cbb60a49a00a",
"readerstudy": "01614a77b1c0b4ecd402be50a8ff96188d5b011d",
"demop": "00aa710f4dc5621a0cb64b0795fbba02e39d7700",
"archive": "0d284528953157759d26c469297afcf6fd367f71",
}

out = f"{'*' * 80}\n"
for user, token in user_tokens.items():
for user, token in USER_TOKENS.items():
digest = crypto.hash_token(token)

AuthToken(
Expand Down
10 changes: 6 additions & 4 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

from httpx import AsyncHTTPTransport, HTTPStatusError, HTTPTransport

ADMIN_TOKEN = "1b9436200001f2eaf57cd77db075cbb60a49a00a"
READERSTUDY_TOKEN = "01614a77b1c0b4ecd402be50a8ff96188d5b011d"
DEMO_PARTICIPANT_TOKEN = "00aa710f4dc5621a0cb64b0795fbba02e39d7700"
ARCHIVE_TOKEN = "0d284528953157759d26c469297afcf6fd367f71"
from tests.scripts.create_test_fixtures import USER_TOKENS

ADMIN_TOKEN = USER_TOKENS["admin"]
READERSTUDY_TOKEN = USER_TOKENS["reader_study"]
DEMO_PARTICIPANT_TOKEN = USER_TOKENS["demo_participant"]
ARCHIVE_TOKEN = USER_TOKENS["archive"]


def recurse_call(func):
Expand Down

0 comments on commit c57d3c2

Please sign in to comment.