def test_get_nonexistent_share_network_name(self): resource_class = share_servers.ShareServer(manager=self, info={}) try: # We expect AttributeError instead of endless loop of getattr resource_class.share_network_name except AttributeError: pass else: raise Exception("Expected exception 'AttributeError' " "has not been raised.")
def setUp(self): super(ShareServerTest, self).setUp() self.share_server_id = 'foo' self.share_network = 'bar' info = { 'id': self.share_server_id, 'share_network_name': self.share_network, } self.resource_class = share_servers.ShareServer(manager=self, info=info)
'status': 'available', 'host': 'host2@backend2#pool2', 'availability_zone': 'zone2', 'share_id': 'fake_share_id_2', 'share_network_id': None, 'share_server_id': None, 'created_at': '2016-04-26 14:15:16' }) share_server = share_servers.ShareServer( share_servers.ShareServerManager(FakeAPIClient), { 'id': 'fake_share_server_id1', 'status': 'active', 'share_network_id': 'fake_share_network_id1', 'share_network_name': 'fake_share_network_name1', 'project_id': 'fake_project_id1', 'backend_details': { 'foo_key': 'foo_value', 'bar_key_foo': 'bar_value_foo', }, 'host': 'fakehost1@fakebackend1#fakepool1' }) share_server_errored = share_servers.ShareServer( share_servers.ShareServerManager(FakeAPIClient), { 'id': 'fake_share_server_id2', 'status': 'error', 'share_network_id': 'fake_share_network_id2', 'share_network_name': 'fake_share_network_name2', 'project_id': 'fake_project_id2', 'backend_details': {},