def setUp(self): super(LXDTestDriver, self).setUp() self.ml = stubs.lxd_mock() lxd_patcher = mock.patch('pylxd.api.API', mock.Mock(return_value=self.ml)) lxd_patcher.start() self.addCleanup(lxd_patcher.stop) self.connection = driver.LXDDriver(fake.FakeVirtAPI())
def setUp(self): super(SessionImageTest, self).setUp() self.ml = stubs.lxd_mock() lxd_patcher = mock.patch('pylxd.api.API', mock.Mock(return_value=self.ml)) lxd_patcher.start() self.addCleanup(lxd_patcher.stop) self.session = session.LXDAPISession()
def setUp(self): super(SessionContainerTest, self).setUp() """This is so we can mock out pylxd API calls.""" self.ml = stubs.lxd_mock() lxd_patcher = mock.patch('pylxd.deprecated.api.API', mock.Mock(return_value=self.ml)) lxd_patcher.start() self.addCleanup(lxd_patcher.stop) self.session = session.LXDAPISession()
def setUp(self): super(SessionSnapshotTest, self).setUp() """This is so we can mock out pylxd API calls.""" self.ml = stubs.lxd_mock() lxd_patcher = mock.patch('pylxd.api.API', mock.Mock(return_value=self.ml)) lxd_patcher.start() self.addCleanup(lxd_patcher.stop) self.session = session.LXDAPISession()
def setUp(self): super(LXDTestContainerOps, self).setUp() self.ml = stubs.lxd_mock() lxd_patcher = mock.patch('pylxd.api.API', mock.Mock(return_value=self.ml)) lxd_patcher.start() self.addCleanup(lxd_patcher.stop) self.operations = ( container_ops.LXDContainerOperations(fake.FakeVirtAPI())) self.mv = mock.MagicMock() vif_patcher = mock.patch.object(self.operations, 'vif_driver', self.mv) vif_patcher.start() self.addCleanup(vif_patcher.stop)