Adam Litke has uploaded a new change for review. Change subject: tests: Refactor hsm import in storage_hsm_test.py ......................................................................
tests: Refactor hsm import in storage_hsm_test.py We currently import HSM from storage.hsm but a future patch needs to monkeypatch the hsm module. Change the import statement and rename uses of the name 'hsm' in the tests. Change-Id: I36e892b0eaf882e8ad68a3c6070745a4dbc30c94 Signed-off-by: Adam Litke <[email protected]> --- M tests/storage_hsm_test.py 1 file changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/60112/1 diff --git a/tests/storage_hsm_test.py b/tests/storage_hsm_test.py index 9a518c5..a4052be 100644 --- a/tests/storage_hsm_test.py +++ b/tests/storage_hsm_test.py @@ -21,6 +21,7 @@ import uuid from contextlib import contextmanager +from monkeypatch import MonkeyPatchScope from testlib import VdsmTestCase from testlib import permutations, expandPermutations from storagetestlib import fake_file_env @@ -30,10 +31,10 @@ from vdsm.storage import constants as sc from vdsm.storage import exception as se -from storage.hsm import HSM +from storage import hsm -class FakeHSM(HSM): +class FakeHSM(hsm.HSM): def __init__(self): pass @@ -47,8 +48,8 @@ with self.fake_volume(vol_fmt) as vol: qemu_fmt = sc.FMT2STR[vol_fmt] qemuimg.create(vol.volumePath, size=self.SIZE, format=qemu_fmt) - hsm = FakeHSM() - self.assertNotRaises(hsm.verify_untrusted_volume, + h = FakeHSM() + self.assertNotRaises(h.verify_untrusted_volume, 'sp', vol.sdUUID, vol.imgUUID, vol.volUUID) @permutations(( @@ -58,9 +59,9 @@ def test_wrong_format_raises(self, vol_fmt, qemu_fmt): with self.fake_volume(vol_fmt) as vol: qemuimg.create(vol.volumePath, size=self.SIZE, format=qemu_fmt) - hsm = FakeHSM() + h = FakeHSM() self.assertRaises(se.ImageVerificationError, - hsm.verify_untrusted_volume, + h.verify_untrusted_volume, 'sp', vol.sdUUID, vol.imgUUID, vol.volUUID) def test_backingfile_raises(self): @@ -68,9 +69,9 @@ qemu_fmt = qemuimg.FORMAT.QCOW2 qemuimg.create(vol.volumePath, size=self.SIZE, format=qemu_fmt, backing='foo') - hsm = FakeHSM() + h = FakeHSM() self.assertRaises(se.ImageVerificationError, - hsm.verify_untrusted_volume, + h.verify_untrusted_volume, 'sp', vol.sdUUID, vol.imgUUID, vol.volUUID) @contextmanager -- To view, visit https://gerrit.ovirt.org/60112 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I36e892b0eaf882e8ad68a3c6070745a4dbc30c94 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
