add id lookup test
All checks were successful
Mypy / mypy (push) Successful in 1m12s
Pytest / pytest (3.14) (push) Successful in 1m18s
Ruff / ruff (push) Successful in 1m2s
Pytest / pytest (3.12) (push) Successful in 1m17s
Pytest / pytest (3.13) (push) Successful in 1m13s

This commit is contained in:
Justus Kuhlmann 2026-03-23 22:43:39 +01:00
commit f8566207e3

View file

@ -32,3 +32,25 @@ def test_find_lookup_by_one_alias(tmp_path: Path) -> None:
with pytest.raises(Exception): with pytest.raises(Exception):
assert uuid == find._project_lookup_by_alias(db, "fun_project") assert uuid == find._project_lookup_by_alias(db, "fun_project")
conn.close() conn.close()
def test_find_lookup_by_id(tmp_path: Path) -> None:
db = make_sql(tmp_path)
conn = sqlite3.connect(db)
c = conn.cursor()
uuid = "test_uuid"
alias_str = "fun_project"
tag_str = "tt"
owner = "tester"
code = "test_code"
c.execute("INSERT INTO projects (id, aliases, customTags, owner, code, created_at, updated_at) VALUES (?, ?, ?, ?, ?, datetime('now'), datetime('now'))",
(uuid, alias_str, tag_str, owner, code))
conn.commit()
conn.close()
result = find._project_lookup_by_id(db, uuid)[0]
assert uuid == result[0]
assert alias_str == result[1]
assert tag_str == result[2]
assert owner == result[3]
assert code == result[4]