def testCreateBackends(self): ch = ConfigHolder(self.cfg_fname) ch._set_backend_proxy_specific_attributes = Mock() for netapp_type in ['netapp.com', '7mode.netapp.com', 'cluster.netapp.com']: ch.get_proxy_name = Mock(return_value=netapp_type) assert isinstance(PdiskBackendProxyFactory.createBackendProxy(ch), NetAppBackend) ch.get_proxy_name = Mock(return_value='ceph.org') assert isinstance(PdiskBackendProxyFactory.createBackendProxy(ch), CephBackend) ch.get_proxy_name = Mock(return_value='file.org') assert isinstance(PdiskBackendProxyFactory.createBackendProxy(ch), FileBackend) ch.get_proxy_name = Mock(return_value='lvm.org') assert isinstance(PdiskBackendProxyFactory.createBackendProxy(ch), LVMBackend)
def testInit(self): ch = ConfigHolder(self.cfg_fname) ch.get_proxy_name = Mock(return_value='foo') self.assertRaises(SystemExit, PdiskBackendProxyFactory.createBackendProxy, ch)