def test_calls(self): mox = self.mox mox.StubOutWithMock(image_utils, "temporary_dir") mox.StubOutWithMock(image_utils, "extract_targz") mox.StubOutWithMock(image_utils, "discover_vhd_chain") mox.StubOutWithMock(image_utils, "fix_vhd_chain") mox.StubOutWithMock(image_utils, "coalesce_chain") mox.StubOutWithMock(image_utils.os, "unlink") mox.StubOutWithMock(image_utils, "rename_file") image_utils.temporary_dir().AndReturn(fake_context("somedir")) image_utils.extract_targz("image", "somedir") image_utils.discover_vhd_chain("somedir").AndReturn(["somedir/0.vhd", "somedir/1.vhd"]) image_utils.fix_vhd_chain(["somedir/0.vhd", "somedir/1.vhd"]) image_utils.coalesce_chain(["somedir/0.vhd", "somedir/1.vhd"]).AndReturn("somedir/1.vhd") image_utils.os.unlink("image") image_utils.rename_file("somedir/1.vhd", "image") mox.ReplayAll() image_utils.replace_xenserver_image_with_coalesced_vhd("image") mox.VerifyAll()
def test_calls(self): mox = self.mox mox.StubOutWithMock(image_utils, 'temporary_dir') mox.StubOutWithMock(image_utils, 'extract_targz') mox.StubOutWithMock(image_utils, 'discover_vhd_chain') mox.StubOutWithMock(image_utils, 'fix_vhd_chain') mox.StubOutWithMock(image_utils, 'coalesce_chain') mox.StubOutWithMock(image_utils.os, 'unlink') mox.StubOutWithMock(image_utils, 'rename_file') image_utils.temporary_dir().AndReturn(fake_context('somedir')) image_utils.extract_targz('image', 'somedir') image_utils.discover_vhd_chain('somedir').AndReturn( ['somedir/0.vhd', 'somedir/1.vhd']) image_utils.fix_vhd_chain(['somedir/0.vhd', 'somedir/1.vhd']) image_utils.coalesce_chain( ['somedir/0.vhd', 'somedir/1.vhd']).AndReturn('somedir/1.vhd') image_utils.os.unlink('image') image_utils.rename_file('somedir/1.vhd', 'image') mox.ReplayAll() image_utils.replace_xenserver_image_with_coalesced_vhd('image') mox.VerifyAll()
def test_calls(self): mox = self.mox mox.StubOutWithMock(image_utils, 'temporary_dir') mox.StubOutWithMock(image_utils, 'extract_targz') mox.StubOutWithMock(image_utils, 'discover_vhd_chain') mox.StubOutWithMock(image_utils, 'fix_vhd_chain') mox.StubOutWithMock(image_utils, 'coalesce_chain') mox.StubOutWithMock(image_utils.os, 'unlink') mox.StubOutWithMock(image_utils, 'rename_file') image_utils.temporary_dir().AndReturn(fake_context('somedir')) image_utils.extract_targz('image', 'somedir') image_utils.discover_vhd_chain('somedir').AndReturn( ['somedir/0.vhd', 'somedir/1.vhd']) image_utils.fix_vhd_chain(['somedir/0.vhd', 'somedir/1.vhd']) image_utils.coalesce_chain(['somedir/0.vhd', 'somedir/1.vhd' ]).AndReturn('somedir/1.vhd') image_utils.os.unlink('image') image_utils.rename_file('somedir/1.vhd', 'image') mox.ReplayAll() image_utils.replace_xenserver_image_with_coalesced_vhd('image') mox.VerifyAll()