From 0be5cb18e239c085c7f1af42619a0150a8e94ff7 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Thu, 4 Dec 2025 14:44:05 +0100 Subject: [PATCH] add more simple init tests --- tests/test_initialization.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/test_initialization.py b/tests/test_initialization.py index 38357bf..966bd07 100644 --- a/tests/test_initialization.py +++ b/tests/test_initialization.py @@ -9,6 +9,29 @@ def test_init_folders(tmp_path): assert os.path.exists(str(dataset_path / "backlogger.db")) +def test_init_folders_no_tracker(tmp_path): + dataset_path = tmp_path / "test_dataset" + init.create(str(dataset_path), tracker="None") + assert os.path.exists(str(dataset_path)) + assert os.path.exists(str(dataset_path / "backlogger.db")) + + +def test_init_config(tmp_path): + dataset_path = tmp_path / "test_dataset" + init.create(str(dataset_path), tracker="None") + config_path = dataset_path / ".corrlib" + assert os.path.exists(str(config_path)) + from configparser import ConfigParser + config = ConfigParser() + config.read(str(config_path)) + assert config.get("core", "tracker") == "None" + assert config.get("paths", "db") == "backlogger.db" + assert config.get("paths", "projects_path") == "projects" + assert config.get("paths", "archive_path") == "archive" + assert config.get("paths", "toml_imports_path") == "toml_imports" + assert config.get("paths", "import_scripts_path") == "import_scripts" + + def test_init_db(tmp_path): dataset_path = tmp_path / "test_dataset" init.create(str(dataset_path)) @@ -24,7 +47,7 @@ def test_init_db(tmp_path): table_names = [table[0] for table in tables] for expected_table in expected_tables: assert expected_table in table_names - + cursor.execute("SELECT * FROM projects;") projects = cursor.fetchall() assert len(projects) == 0 @@ -47,7 +70,7 @@ def test_init_db(tmp_path): project_column_names = [col[1] for col in project_columns] for expected_col in expected_project_columns: assert expected_col in project_column_names - + cursor.execute("PRAGMA table_info('backlogs');") backlog_columns = cursor.fetchall() expected_backlog_columns = [