mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-01 01:27:17 +00:00
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:
parent
889c7eee6a
commit
e125f3a4b1
|
@ -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
|
||||
|
||||
|
||||
|
|
0
tests/test_graphql/data/gitkeep
Normal file
0
tests/test_graphql/data/gitkeep
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"tokens": [
|
||||
{
|
||||
"token": "TEST_TOKEN",
|
||||
"name": "Test Token",
|
||||
"date": "2022-01-14 08:31:10.789314"
|
||||
}
|
||||
]
|
||||
}
|
0
tests/test_rest_endpoints/services/gitkeep
Normal file
0
tests/test_rest_endpoints/services/gitkeep
Normal file
Loading…
Reference in a new issue