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
This commit is contained in:
Houkime 2022-12-28 12:44:51 +00:00
parent 40d331d01f
commit cee0419a52
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"
}
]
}