Capture ThinkStorm project: codebase state, workflows, and access control policies
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Database & Sequence Generator Unit Tests
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import sqlite3
|
||||
from thinkstorm.database import init_db, get_db, next_sequence, hash_password
|
||||
from thinkstorm.models import UserRole
|
||||
|
||||
def test_init_db_and_seeds():
|
||||
init_db()
|
||||
with get_db() as conn:
|
||||
users = conn.execute("SELECT * FROM users").fetchall()
|
||||
assert len(users) >= 2
|
||||
|
||||
categories = conn.execute("SELECT * FROM categories").fetchall()
|
||||
assert len(categories) >= 5
|
||||
|
||||
work_types = conn.execute("SELECT * FROM work_types").fetchall()
|
||||
assert len(work_types) >= 3
|
||||
|
||||
prompts = conn.execute("SELECT * FROM prompt_definitions").fetchall()
|
||||
assert len(prompts) >= 5
|
||||
|
||||
def test_sequence_generators():
|
||||
s1 = next_sequence("idea")
|
||||
s2 = next_sequence("idea")
|
||||
assert s1.startswith("TS-")
|
||||
assert s2.startswith("TS-")
|
||||
assert int(s2.split("-")[1]) == int(s1.split("-")[1]) + 1
|
||||
|
||||
w1 = next_sequence("work_track")
|
||||
assert w1.startswith("WT-")
|
||||
|
||||
r1 = next_sequence("run")
|
||||
assert r1.startswith("RUN-")
|
||||
Reference in New Issue
Block a user