MCPcopy
hub / github.com/guelfoweb/knockpy / test_storage_settings_roundtrip

Function test_storage_settings_roundtrip

tests/test_storage_api.py:62–81  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

60
61
62def test_storage_settings_roundtrip(tmp_path: Path):
63 db_path = tmp_path / "reports.db"
64 init_db(db_path)
65
66 set_setting("runtime.timeout", "4", db_path=db_path)
67 set_setting("runtime.threads", "120", db_path=db_path)
68 set_setting("api.shodan", None, db_path=db_path)
69
70 assert get_setting("runtime.timeout", db_path=db_path) == "4"
71 assert get_setting("runtime.threads", db_path=db_path) == "120"
72 assert get_setting("api.shodan", db_path=db_path) is None
73 assert get_setting("missing", db_path=db_path) is None
74
75 all_settings = get_settings(db_path=db_path)
76 assert all_settings["runtime.timeout"] == "4"
77 assert all_settings["runtime.threads"] == "120"
78 assert "api.shodan" in all_settings
79
80 runtime_only = get_settings(prefix="runtime.", db_path=db_path)
81 assert sorted(runtime_only.keys()) == ["runtime.threads", "runtime.timeout"]
82
83
84def test_storage_reset_reports_returns_deleted_count(tmp_path: Path):

Callers

nothing calls this directly

Calls 4

init_dbFunction · 0.90
set_settingFunction · 0.90
get_settingFunction · 0.90
get_settingsFunction · 0.90

Tested by

no test coverage detected