#2533: clean up temp items in tests + fixing the CLI tests

This commit is contained in:
Czar Echavez
2024-05-01 14:33:33 +01:00
parent a2fb04e6f6
commit b6b5ce91c2
5 changed files with 44 additions and 53 deletions

View File

@@ -1,3 +1,5 @@
from typing import Dict, Optional
import yaml
from primaite import PRIMAITE_CONFIG, PRIMAITE_PATHS
@@ -8,7 +10,13 @@ def is_dev_mode() -> bool:
return PRIMAITE_CONFIG["developer_mode"]["enabled"]
def update_primaite_application_config() -> None:
"""Update the PrimAITE application config file."""
def update_primaite_application_config(config: Optional[Dict] = None) -> None:
"""
Update the PrimAITE application config file.
:params: config: Leave empty so that PRIMAITE_CONFIG is used - otherwise provide the Dict
"""
with open(PRIMAITE_PATHS.app_config_file_path, "w") as file:
yaml.dump(PRIMAITE_CONFIG, file)
if not config:
config = PRIMAITE_CONFIG
yaml.dump(config, file)