def test_chain_of_two_vhds(self): self.mox.StubOutWithMock(image_utils, 'get_vhd_size') self.mox.StubOutWithMock(image_utils, 'temporary_dir') self.mox.StubOutWithMock(image_utils, 'resize_vhd') self.mox.StubOutWithMock(image_utils, 'coalesce_vhd') self.mox.StubOutWithMock(image_utils, 'temporary_file') image_utils.get_vhd_size('0.vhd').AndReturn(1024) image_utils.temporary_dir().AndReturn(fake_context('tdir')) image_utils.resize_vhd('1.vhd', 1024, 'tdir/vhd-util-resize-journal') image_utils.coalesce_vhd('0.vhd') self.mox.ReplayAll() result = image_utils.coalesce_chain(['0.vhd', '1.vhd']) self.mox.VerifyAll() self.assertEqual('1.vhd', result)
def test_chain_of_two_vhds(self): self.mox.StubOutWithMock(image_utils, 'get_vhd_size') self.mox.StubOutWithMock(image_utils, 'temporary_dir') self.mox.StubOutWithMock(image_utils, 'resize_vhd') self.mox.StubOutWithMock(image_utils, 'coalesce_vhd') self.mox.StubOutWithMock(image_utils, 'temporary_file') image_utils.get_vhd_size('0.vhd').AndReturn(1024) image_utils.temporary_dir().AndReturn(fake_context('tdir')) image_utils.resize_vhd('1.vhd', 1024, 'tdir/vhd-util-resize-journal') image_utils.coalesce_vhd('0.vhd') self.mox.ReplayAll() result = image_utils.coalesce_chain(['0.vhd', '1.vhd']) self.mox.VerifyAll() self.assertEquals('1.vhd', result)
def test_chain_of_two_vhds(self): self.mox.StubOutWithMock(image_utils, "get_vhd_size") self.mox.StubOutWithMock(image_utils, "temporary_dir") self.mox.StubOutWithMock(image_utils, "resize_vhd") self.mox.StubOutWithMock(image_utils, "coalesce_vhd") self.mox.StubOutWithMock(image_utils, "temporary_file") image_utils.get_vhd_size("0.vhd").AndReturn(1024) image_utils.temporary_dir().AndReturn(fake_context("tdir")) image_utils.resize_vhd("1.vhd", 1024, "tdir/vhd-util-resize-journal") image_utils.coalesce_vhd("0.vhd") self.mox.ReplayAll() result = image_utils.coalesce_chain(["0.vhd", "1.vhd"]) self.mox.VerifyAll() self.assertEqual("1.vhd", result)
def test_vhd_util_call(self): mox = self.mox mox.StubOutWithMock(utils, "execute") utils.execute("vhd-util", "query", "-n", "vhdfile", "-v").AndReturn(("1024", "ignored")) mox.ReplayAll() result = image_utils.get_vhd_size("vhdfile") mox.VerifyAll() self.assertEqual(1024, result)
def test_vhd_util_call(self): mox = self.mox mox.StubOutWithMock(utils, 'execute') utils.execute('vhd-util', 'query', '-n', 'vhdfile', '-v').AndReturn( ('1024', 'ignored')) mox.ReplayAll() result = image_utils.get_vhd_size('vhdfile') mox.VerifyAll() self.assertEquals(1024, result)
def test_vhd_util_call(self): mox = self.mox mox.StubOutWithMock(utils, 'execute') utils.execute( 'vhd-util', 'query', '-n', 'vhdfile', '-v').AndReturn( ('1024', 'ignored')) mox.ReplayAll() result = image_utils.get_vhd_size('vhdfile') mox.VerifyAll() self.assertEqual(1024, result)