mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-09 06:56:37 +00:00
- The option that edits an installed application is Modify for one container and for a multi-container application, in the OCI menu and on the Monitor button. Recreate is only the rebuild of a multi-container application as it is. - A stack recreation says "Recreating" and "Recreated" in its steps instead of "Updating". - The notes of the GPU, Coral, disk and share menus no longer name the option. - Spanish for the new texts; the English copies of the stack texts are removed from de, fr, pt and sv so the bot translates them.
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
"""The steps of a coordinated operation name the operation that is running."""
|
|
|
|
from pathlib import Path
|
|
import sys
|
|
import unittest
|
|
from unittest.mock import MagicMock, patch
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "remote"))
|
|
|
|
import oci_stack_transaction as transaction
|
|
|
|
|
|
class StackOperationWording(unittest.TestCase):
|
|
def steps(self, operation):
|
|
plan = {"operation": operation, "primary_vmid": 138, "members": [{"vmid": 138}],
|
|
"start_order": [138], "stop_order": [138]}
|
|
adapter = MagicMock(spec=["validate", "is_running", "prepare", "stop", "backup", "verify_backups", "replace",
|
|
"start", "healthcheck", "validate_candidates", "restore_running_state", "publish"])
|
|
adapter.is_running.return_value = False
|
|
adapter.prepare.return_value = {}
|
|
adapter.backup.return_value = "backup"
|
|
said = []
|
|
with patch.object(transaction, "save"), patch.object(transaction, "translate", side_effect=lambda text: text), \
|
|
patch.object(transaction, "msg_info", side_effect=said.append), \
|
|
patch.object(transaction, "msg_ok", side_effect=said.append):
|
|
transaction._apply(Path("/nonexistent/journal.json"), plan, adapter)
|
|
return said
|
|
|
|
def test_a_recreation_never_says_it_is_updating(self):
|
|
said = self.steps("recreate")
|
|
self.assertIn("Recreating CT 138...", said)
|
|
self.assertIn("Recreated: CT 138", said)
|
|
self.assertIn("Recreated stack checked", said)
|
|
self.assertEqual([line for line in said if "pdat" in line], [])
|
|
|
|
def test_an_update_keeps_its_wording(self):
|
|
said = self.steps("update")
|
|
self.assertIn("Updating CT 138...", said)
|
|
self.assertIn("Updated: CT 138", said)
|
|
self.assertIn("Updated stack checked", said)
|
|
self.assertEqual([line for line in said if "ecreat" in line], [])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|