Disable default credentials save (#3290)

This commit is contained in:
codefiles 2025-03-22 00:21:43 -04:00 committed by GitHub
parent d326ceff45
commit 16a84ba662
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -105,12 +105,13 @@ class ConfigurationOutput:
target.write_text(self.user_credentials_to_json())
target.chmod(stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)
def save(self, dest_path: Path | None = None) -> None:
def save(self, dest_path: Path | None = None, creds: bool = False) -> None:
save_path = dest_path or self._default_save_path
if self._is_valid_path(save_path):
self.save_user_config(save_path)
self.save_user_creds(save_path)
if creds:
self.save_user_creds(save_path)
def save_config(config: ArchConfig) -> None:
@ -206,4 +207,4 @@ def save_config(config: ArchConfig) -> None:
case "user_creds":
config_output.save_user_creds(dest_path)
case "all":
config_output.save(dest_path)
config_output.save(dest_path, creds=True)

View File

@ -60,7 +60,7 @@ def test_creds_roundtrip(
test_out_dir = Path('/tmp/')
test_out_file = test_out_dir / config_output.user_credentials_file
config_output.save(test_out_dir)
config_output.save(test_out_dir, creds=True)
result = json.loads(test_out_file.read_text())
expected = json.loads(creds_fixture.read_text())