test(tokens-repo): remove test tokens.json files

except for one which will temporarily remain
gitkeeps are to prevent shared_datadir from erroring out in a freshly
cloned repo. for now huey database and jobs fixtures use shared_datadir
redis/connection-pool
Houkime 2022-12-28 12:44:51 +00:00 committed by Inex Code
parent 889c7eee6a
commit e125f3a4b1
6 changed files with 11 additions and 41 deletions

View File

@ -4,18 +4,25 @@
import os
import pytest
from fastapi.testclient import TestClient
from shutil import copy
import os.path as path
def pytest_generate_tests(metafunc):
os.environ["TEST_MODE"] = "true"
def global_data_dir():
return path.join(path.dirname(__file__), "data")
@pytest.fixture
def tokens_file(mocker, shared_datadir):
def tokens_file(mocker, tmpdir):
"""Mock tokens file."""
mock = mocker.patch(
"selfprivacy_api.utils.TOKENS_FILE", shared_datadir / "tokens.json"
)
tmp_file = tmpdir / "tokens.json"
source_file = path.join(global_data_dir(), "tokens.json")
copy(source_file, tmp_file)
mock = mocker.patch("selfprivacy_api.utils.TOKENS_FILE", tmp_file)
return mock

View File

View File

@ -1,14 +0,0 @@
{
"tokens": [
{
"token": "TEST_TOKEN",
"name": "test_token",
"date": "2022-01-14 08:31:10.789314"
},
{
"token": "TEST_TOKEN2",
"name": "test_token2",
"date": "2022-01-14 08:31:10.789314"
}
]
}

View File

@ -1,14 +0,0 @@
{
"tokens": [
{
"token": "TEST_TOKEN",
"name": "test_token",
"date": "2022-01-14 08:31:10.789314"
},
{
"token": "TEST_TOKEN2",
"name": "test_token2",
"date": "2022-01-14 08:31:10.789314"
}
]
}

View File

@ -1,9 +0,0 @@
{
"tokens": [
{
"token": "TEST_TOKEN",
"name": "Test Token",
"date": "2022-01-14 08:31:10.789314"
}
]
}