Skip to content

Commit

Permalink
virt.test_update: move some code to make test more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
cbosdo committed Sep 2, 2020
1 parent c85e22e commit b9c26ab
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/unit/modules/test_virt.py
Expand Up @@ -1847,16 +1847,6 @@ def test_update(self):
"cmdline": "console=ttyS0 ks=http://example.com/f8-i386/os/",
}

boot_uefi = {
"loader": "/usr/share/OVMF/OVMF_CODE.fd",
"nvram": "/usr/share/OVMF/OVMF_VARS.ms.fd",
}

invalid_boot = {
"loader": "/usr/share/OVMF/OVMF_CODE.fd",
"initrd": "/root/f8-i386-initrd",
}

# Update boot devices case
define_mock.reset_mock()
self.assertEqual(
Expand Down Expand Up @@ -1910,6 +1900,11 @@ def test_update(self):
"console=ttyS0 ks=http://example.com/f8-i386/os/",
)

boot_uefi = {
"loader": "/usr/share/OVMF/OVMF_CODE.fd",
"nvram": "/usr/share/OVMF/OVMF_VARS.ms.fd",
}

self.assertEqual(
{
"definition": True,
Expand Down Expand Up @@ -1940,6 +1935,11 @@ def test_update(self):
setxml = ET.fromstring(define_mock.call_args[0][0])
self.assertEqual(setxml.find("os").attrib.get("firmware"), "efi")

invalid_boot = {
"loader": "/usr/share/OVMF/OVMF_CODE.fd",
"initrd": "/root/f8-i386-initrd",
}

with self.assertRaises(SaltInvocationError):
virt.update("my_vm", boot=invalid_boot)

Expand Down

0 comments on commit b9c26ab

Please sign in to comment.