fix: :memory: db handling + tests (7/7 pass, +csrf +auth tests)
CI / test (push) Failing after 4s
CI / lint (push) Failing after 4s

- config: handle sqlite:///:memory: properly in db_path
- db: skip mkdir for :memory: path
- tests: use temp file instead of :memory: (avoids per-connection DB isolation)
- tests: added test_csrf_rejected (403) and test_auth_user
This commit is contained in:
2026-07-08 09:25:52 -04:00
parent 5a124d1328
commit 2b83c658f6
3 changed files with 28 additions and 5 deletions
+2
View File
@@ -43,6 +43,8 @@ class Settings(BaseSettings):
@property
def db_path(self) -> Path:
if self.database_url == "sqlite:///:memory:":
return Path(":memory:") # Special SQLite in-memory
if self.database_url.startswith("sqlite:///"):
return Path(self.database_url.replace("sqlite:///", "/"))
return Path("/data/flowdeck.db")
+2 -1
View File
@@ -14,7 +14,8 @@ def get_db_path() -> Path:
def init_db():
"""Create tables if they don't exist."""
db_path = get_db_path()
db_path.parent.mkdir(parents=True, exist_ok=True)
if str(db_path) != ":memory:":
db_path.parent.mkdir(parents=True, exist_ok=True)
with get_conn() as conn:
conn.execute("PRAGMA journal_mode=WAL")