def setUp(self):
     self.ensure_fn = LXCHypervisor._EnsureDirectoryExistence
     LXCHypervisor._EnsureDirectoryExistence = mock.Mock(return_value=False)
     self.hv = LXCHypervisor()
 def testInactive(self, runcmd_mock):
     runcmd_mock.return_value = RunResultOk("inst1 inst2foo")
     self.assertFalse(LXCHypervisor._IsInstanceAlive("inst2"))
 def testInactive(self, runcmd_mock):
   runcmd_mock.return_value = RunResultOk("inst1 inst2foo")
   self.assertFalse(LXCHypervisor._IsInstanceAlive("inst2"))
 def testActive(self, runcmd_mock):
     runcmd_mock.return_value = RunResultOk(
         "inst1 inst2 inst3\ninst4 inst5")
     self.assertTrue(LXCHypervisor._IsInstanceAlive("inst4"))
 def testActive(self, runcmd_mock):
   runcmd_mock.return_value = RunResultOk("inst1 inst2 inst3\ninst4 inst5")
   self.assertTrue(LXCHypervisor._IsInstanceAlive("inst4"))