21 lines
725 B
Python
21 lines
725 B
Python
"""In-process API tests: a platform of their own (never the deployed data folder)."""
|
|
|
|
import pytest
|
|
|
|
from webapi import sources, users
|
|
|
|
|
|
@pytest.fixture
|
|
def own_platform(tmp_path, monkeypatch):
|
|
"""The API's data folder, platform database and sign-in in tmp_path."""
|
|
monkeypatch.setenv("ISSSTELEON_DATA", str(tmp_path))
|
|
monkeypatch.setattr(sources, "DATA_DIR", tmp_path)
|
|
monkeypatch.setattr(users, "DATA_DIR", tmp_path)
|
|
monkeypatch.setenv("PLATFORM_DATABASE_URL", f"sqlite:///{tmp_path / 'platform.db'}")
|
|
monkeypatch.delenv("AUTH_SECRET", raising=False)
|
|
users._engine.cache_clear()
|
|
users._secret.cache_clear()
|
|
yield tmp_path
|
|
users._engine.cache_clear()
|
|
users._secret.cache_clear()
|