add more simple init tests
This commit is contained in:
parent
303dbdd2dc
commit
0be5cb18e2
1 changed files with 25 additions and 2 deletions
|
|
@ -9,6 +9,29 @@ def test_init_folders(tmp_path):
|
||||||
assert os.path.exists(str(dataset_path / "backlogger.db"))
|
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):
|
def test_init_db(tmp_path):
|
||||||
dataset_path = tmp_path / "test_dataset"
|
dataset_path = tmp_path / "test_dataset"
|
||||||
init.create(str(dataset_path))
|
init.create(str(dataset_path))
|
||||||
|
|
@ -24,7 +47,7 @@ def test_init_db(tmp_path):
|
||||||
table_names = [table[0] for table in tables]
|
table_names = [table[0] for table in tables]
|
||||||
for expected_table in expected_tables:
|
for expected_table in expected_tables:
|
||||||
assert expected_table in table_names
|
assert expected_table in table_names
|
||||||
|
|
||||||
cursor.execute("SELECT * FROM projects;")
|
cursor.execute("SELECT * FROM projects;")
|
||||||
projects = cursor.fetchall()
|
projects = cursor.fetchall()
|
||||||
assert len(projects) == 0
|
assert len(projects) == 0
|
||||||
|
|
@ -47,7 +70,7 @@ def test_init_db(tmp_path):
|
||||||
project_column_names = [col[1] for col in project_columns]
|
project_column_names = [col[1] for col in project_columns]
|
||||||
for expected_col in expected_project_columns:
|
for expected_col in expected_project_columns:
|
||||||
assert expected_col in project_column_names
|
assert expected_col in project_column_names
|
||||||
|
|
||||||
cursor.execute("PRAGMA table_info('backlogs');")
|
cursor.execute("PRAGMA table_info('backlogs');")
|
||||||
backlog_columns = cursor.fetchall()
|
backlog_columns = cursor.fetchall()
|
||||||
expected_backlog_columns = [
|
expected_backlog_columns = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue