From 2396a657b29482060917ecb2a99a13ee70f091ae Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 23 Mar 2026 17:50:38 +0100 Subject: [PATCH 1/3] rename init_tests --- tests/{test_initialization.py => initialization_test.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{test_initialization.py => initialization_test.py} (100%) diff --git a/tests/test_initialization.py b/tests/initialization_test.py similarity index 100% rename from tests/test_initialization.py rename to tests/initialization_test.py From a57138dc50f1c1caca90794a14d53b11efa5165b Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 23 Mar 2026 18:26:17 +0100 Subject: [PATCH 2/3] add test for project alias lookup --- tests/find_test.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/find_test.py diff --git a/tests/find_test.py b/tests/find_test.py new file mode 100644 index 0000000..b63b246 --- /dev/null +++ b/tests/find_test.py @@ -0,0 +1,33 @@ +import corrlib.find as find +import sqlite3 +from pathlib import Path +import corrlib.initialization as cinit +import pytest + + +def make_sql(path: Path) -> Path: + db = path / "test.db" + cinit._create_db(db) + return db + +def test_find_lookup_by_one_alias(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() + assert uuid == find._project_lookup_by_alias(db, "fun_project") + uuid = "test_uuid2" + alias_str = "fun_project" + 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() + with pytest.raises(Exception): + assert uuid == find._project_lookup_by_alias(db, "fun_project") + conn.close() From 8a8480af32a16c9bcdafea031f4951eeee3f8250 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 23 Mar 2026 18:26:40 +0100 Subject: [PATCH 3/3] fix alias db --- corrlib/find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corrlib/find.py b/corrlib/find.py index faef5db..4c51e05 100644 --- a/corrlib/find.py +++ b/corrlib/find.py @@ -28,7 +28,7 @@ def _project_lookup_by_alias(db: Path, alias: str) -> str: """ conn = sqlite3.connect(db) c = conn.cursor() - c.execute(f"SELECT * FROM 'projects' WHERE alias = '{alias}'") + c.execute(f"SELECT * FROM 'projects' WHERE aliases = '{alias}'") results = c.fetchall() conn.close() if len(results)>1: