def test_share_network_create(self, **kwargs): expected_kwargs = { "name": None, "description": None, "neutron_net_id": None, "neutron_subnet_id": None, } expected_kwargs.update(kwargs) api.share_network_create(self.request, **kwargs) mock_sn_create = self.manilaclient.share_networks.create mock_sn_create.assert_called_once_with(**expected_kwargs)
def handle(self, request, data): try: # Remove any new lines in the public key share_network = manila.share_network_create(request, **data) messages.success( request, _('Successfully created share network: %s') % data['name']) return share_network except Exception: exceptions.handle(request, _('Unable to create share network.')) return False
def handle(self, request, data): try: # Remove any new lines in the public key share_network = manila.share_network_create(request, **data) messages.success(request, _('Successfully created share network: %s') % data['name']) return share_network except Exception: exceptions.handle(request, _('Unable to create share network.')) return False
def handle(self, request, data): try: send_data = {'name': data['name']} if data['description']: send_data['description'] = data['description'] share_net_id = data.get('neutron_net_id') if self.neutron_enabled and share_net_id: send_data['neutron_net_id'] = share_net_id.strip() subnet_key = 'subnet-choices-%s' % share_net_id if subnet_key in data: send_data['neutron_subnet_id'] = data[subnet_key] share_network = manila.share_network_create(request, **send_data) messages.success( request, _('Successfully created share' ' network: %s') % send_data['name']) return share_network except Exception: exceptions.handle(request, _('Unable to create share network.')) return False
def handle(self, request, data): try: send_data = {'name': data['name']} if data['description']: send_data['description'] = data['description'] share_net_id = data.get('neutron_net_id', data.get('nova_net_id')) share_net_id = share_net_id.strip() if self.neutron_enabled and share_net_id: send_data['neutron_net_id'] = share_net_id subnet_key = 'subnet-choices-%s' % share_net_id if subnet_key in data: send_data['neutron_subnet_id'] = data[subnet_key] elif not self.neutron_enabled and share_net_id: send_data['nova_net_id'] = data['nova_net_id'] share_network = manila.share_network_create(request, **send_data) messages.success(request, _('Successfully created share' ' network: %s') % send_data['name']) return share_network except Exception: exceptions.handle(request, _('Unable to create share network.')) return False