def test_get_reads_key_from_file() -> None: path = Path.cwd() / "config.json" with path.open("w+", encoding="utf-8") as file: file.write('{ "key": "value" }') storage = Storage(str(path)) assert storage.get("key") == "value"
def test_get_returns_default_when_key_not_set() -> None: path = Path.cwd() / "config.json" with path.open("w+", encoding="utf-8") as file: file.write('{ "key": "value" }') storage = Storage(str(path)) assert storage.get("key2", "my-default") == "my-default"
def test_create_new_project_sets_description_in_project_config() -> None: project_path = Path.cwd() / "Python Project" project_manager = ProjectManager(ProjectConfigManager()) project_manager.create_new_project(project_path, QCLanguage.Python) config = Storage(str(project_path / "config.json")) assert config.get("description") == ""
def test_create_new_project_sets_parameters_in_project_config() -> None: project_path = Path.cwd() / "Python Project" project_manager = _create_project_manager() project_manager.create_new_project(project_path, QCLanguage.Python) config = Storage(str(project_path / "config.json")) assert config.get("parameters") == {}
def test_create_new_project_sets_language_in_project_config( language: QCLanguage) -> None: project_path = Path.cwd() / f"{language.name} Project" project_manager = ProjectManager(ProjectConfigManager()) project_manager.create_new_project(project_path, language) config = Storage(str(project_path / "config.json")) assert config.get("algorithm-language") == language.name