chore: prepare release v0.4.0
This commit is contained in:
+9
-8
@@ -17,14 +17,14 @@ from volumen.users import Users
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _reset_login_attempts() -> Generator[None, None, None]:
|
||||
def _reset_login_attempts() -> Generator[None]:
|
||||
"""Reset the global login-attempts tracker before every test."""
|
||||
reset_login_attempts()
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tmp_dir() -> Generator[Path, None, None]:
|
||||
def tmp_dir() -> Generator[Path]:
|
||||
"""Create a temporary directory that is cleaned up after the test."""
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
yield Path(d)
|
||||
@@ -43,11 +43,12 @@ def tmp_content_dir(tmp_path: Path) -> Path:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config(tmp_content_dir: Path) -> Config:
|
||||
def config(tmp_content_dir: Path, tmp_path: Path) -> Config:
|
||||
"""Test Config instance pointing at a temp content directory."""
|
||||
users_file = str(tmp_path / "users.toml")
|
||||
return Config.load(
|
||||
path="/nonexistent/volumen.toml",
|
||||
overrides={"content": str(tmp_content_dir)},
|
||||
overrides={"content": str(tmp_content_dir), "users_file": users_file},
|
||||
)
|
||||
|
||||
|
||||
@@ -66,7 +67,7 @@ def users_path(tmp_path: Path) -> str:
|
||||
@pytest.fixture
|
||||
def bootstrap_hash() -> str:
|
||||
"""A pre-hashed password for bootstrap tests."""
|
||||
return hash_pw("secret")
|
||||
return hash_pw("volumen-test-password")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -78,7 +79,7 @@ def users(users_path: str, bootstrap_hash: str) -> Users:
|
||||
@pytest.fixture
|
||||
def client(config: Config, store: Store) -> TestClient:
|
||||
"""FastAPI TestClient for public API tests."""
|
||||
from volumen.server import create_app
|
||||
from volumen.app import create_app
|
||||
|
||||
app = create_app(config, store)
|
||||
return TestClient(app)
|
||||
@@ -91,7 +92,7 @@ def admin_config_dir(tmp_path: Path) -> Path:
|
||||
posts_dir.mkdir()
|
||||
users_path = tmp_path / "users.toml"
|
||||
config_path = tmp_path / "config.toml"
|
||||
pw_hash = hash_pw("secret")
|
||||
pw_hash = hash_pw("volumen-test-password")
|
||||
config_path.write_text(
|
||||
f'content_dir = "{posts_dir}"\n'
|
||||
f'users_file = "{users_path}"\n\n'
|
||||
@@ -104,8 +105,8 @@ def admin_config_dir(tmp_path: Path) -> Path:
|
||||
@pytest.fixture
|
||||
def admin_client(admin_config_dir: Path) -> TestClient:
|
||||
"""FastAPI TestClient for admin tests with bootstrap admin."""
|
||||
from volumen.app import create_app
|
||||
from volumen.config import Config
|
||||
from volumen.server import create_app
|
||||
from volumen.store import Store
|
||||
|
||||
config = Config.load(path=str(admin_config_dir / "config.toml"))
|
||||
|
||||
Reference in New Issue
Block a user