updated database path logic
This commit is contained in:
+22
-1
@@ -1,7 +1,7 @@
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from flask_fatima import create_app, log_database_summary
|
||||
from flask_fatima import create_app, load_yaml_config, log_database_summary
|
||||
|
||||
URL_PREFIX = "/fatima"
|
||||
|
||||
@@ -44,6 +44,27 @@ def test_database_summary_is_appended_to_log(capsys):
|
||||
assert "Fatima database:" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_database_path_is_resolved_relative_to_config_file():
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
config_path = Path(directory) / "production.yaml"
|
||||
config_path.write_text(
|
||||
"""
|
||||
flask:
|
||||
secret_key: test-secret
|
||||
database: data/calendar.sqlite
|
||||
auth:
|
||||
username: user
|
||||
password: pass
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
config = load_yaml_config(config_path)
|
||||
assert config["DATABASE"] == str(
|
||||
(Path(directory) / "data" / "calendar.sqlite").resolve()
|
||||
)
|
||||
|
||||
|
||||
def test_prefix_applies_to_generated_links_and_unprefixed_routes_are_rejected():
|
||||
test_client = client()
|
||||
test_client.post(url("/login"), data={"username": "user", "password": "pass"})
|
||||
|
||||
Reference in New Issue
Block a user