class TestEsx(TestBase): def setUp(self): config = Config('test', 'vdsm') def fakeSecureConnect(self): return MagicMock() Vdsm._secureConnect = fakeSecureConnect self.vdsm = Vdsm(self.logger, config) self.vdsm.prepare() def test_connect(self): self.vdsm.server.list = MagicMock() self.vdsm.server.list.return_value = { 'status': { 'code': 0 }, 'vmList': [{ 'vmId': '1', 'status': 'Down' }, { 'vmId': '2', 'status': 'Up' }, { 'vmId': '3', 'status': 'Up' }] } domains = self.vdsm.listDomains() self.assertEquals([d.uuid for d in domains], ['1', '2', '3']) self.vdsm.server.list.assert_called_once()
class TestEsx(TestBase): def setUp(self): config = Config('test', 'vdsm') def fakeSecureConnect(self): return MagicMock() Vdsm._secureConnect = fakeSecureConnect self.vdsm = Vdsm(self.logger, config) self.vdsm.prepare() def test_connect(self): self.vdsm.server.list = MagicMock() self.vdsm.server.list.return_value = { 'status': { 'code': 0 }, 'vmList': [ { 'vmId': '1', 'status': 'Down' }, { 'vmId': '2', 'status': 'Up' }, { 'vmId': '3', 'status': 'Up' } ] } domains = self.vdsm.listDomains() self.assertEquals([d.uuid for d in domains], ['1', '2', '3']) self.vdsm.server.list.assert_called_once()
def setUp(self): config = Config('test', 'vdsm') def fakeSecureConnect(self): return MagicMock() Vdsm._secureConnect = fakeSecureConnect self.vdsm = Vdsm(self.logger, config) self.vdsm.prepare()
def setUp(self): config = Config('test', 'vdsm') def fakeSecureConnect(self): return MagicMock() Vdsm._secureConnect = fakeSecureConnect self.vdsm = Vdsm(self.logger, config)