mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
Let a storage return to the Proxmox default retention and match the job editor labels
- An empty policy removes the storage setting with --delete prune-backups, and a storage without a policy opens with that choice - Retention fields use the Keep last, Keep daily... labels of the backup job editor - A retention count of zero is rejected before calling Proxmox - Spanish uses backups for the retention messages
This commit is contained in:
@@ -130,9 +130,13 @@ class VmBackupJobsApiTests(unittest.TestCase):
|
||||
self.assertEqual(self.storage_policy("keep-all=1").status_code, 200)
|
||||
self.assertEqual(self.changes()[0][-1], "keep-all=1")
|
||||
|
||||
def test_an_empty_policy_returns_the_storage_to_the_proxmox_default(self):
|
||||
self.assertEqual(self.storage_policy("").status_code, 200)
|
||||
self.assertEqual(self.changes(), [["set", "/storage/local", "--digest", "a" * 40, "--delete", "prune-backups"]])
|
||||
|
||||
def test_invalid_storage_retention_is_rejected_before_commands(self):
|
||||
invalid = [None, [], {}, {"digest": "a" * 40, "prune_backups": []}]
|
||||
for prune in ("", "keep-last=-1", "keep-all=0", "keep-all=2", "keep-last=0", "keep-last=1,keep-last=2",
|
||||
for prune in ("keep-last=3,keep-daily=0", "keep-last=-1", "keep-all=0", "keep-all=2", "keep-last=0", "keep-last=1,keep-last=2",
|
||||
"keep-all=1,keep-last=2", "keep-last=2 --delete path", "keep-last=1\n", "keep-other=1"):
|
||||
invalid.append({"digest": "a" * 40, "prune_backups": prune})
|
||||
invalid += [{"digest": "invalid", "prune_backups": "keep-last=1"}]
|
||||
|
||||
Reference in New Issue
Block a user