feat(product-suite): persist context and confirm actions
This commit is contained in:
@@ -41,6 +41,10 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
},
|
||||
appconfig.product_suite_last_settings(config),
|
||||
)
|
||||
self.assertEqual(
|
||||
"",
|
||||
appconfig.product_suite_last_account_alias(config),
|
||||
)
|
||||
|
||||
updated = appconfig.update_config(
|
||||
{"ai": {"resolution": "2k"}},
|
||||
@@ -84,6 +88,7 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
"chrome_path": "custom-chrome.exe",
|
||||
"custom_section": {"keep": True},
|
||||
"product_suite": {
|
||||
"last_account_alias": ["invalid"],
|
||||
"last_settings": {
|
||||
"platform": "未知平台",
|
||||
"country": "新加坡",
|
||||
@@ -108,10 +113,15 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
},
|
||||
appconfig.product_suite_last_settings(loaded),
|
||||
)
|
||||
self.assertEqual(
|
||||
"",
|
||||
appconfig.product_suite_last_account_alias(loaded),
|
||||
)
|
||||
|
||||
updated = appconfig.update_config(
|
||||
{
|
||||
"product_suite": {
|
||||
"last_account_alias": " alias-b ",
|
||||
"last_settings": {
|
||||
"platform": "Amazon",
|
||||
"country": "中国台湾",
|
||||
@@ -125,6 +135,10 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
|
||||
self.assertEqual("custom-chrome.exe", updated["chrome_path"])
|
||||
self.assertEqual({"keep": True}, updated["custom_section"])
|
||||
self.assertEqual(
|
||||
"alias-b",
|
||||
appconfig.product_suite_last_account_alias(updated),
|
||||
)
|
||||
self.assertEqual("16:9", appconfig.product_suite_last_settings(updated)["ratio"])
|
||||
with open(config_path, "r", encoding="utf-8") as fh:
|
||||
persisted = json.load(fh)
|
||||
@@ -132,6 +146,10 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
{"platform", "country", "language", "ratio"},
|
||||
set(persisted["product_suite"]["last_settings"]),
|
||||
)
|
||||
self.assertEqual(
|
||||
"alias-b",
|
||||
persisted["product_suite"]["last_account_alias"],
|
||||
)
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user