def test_network_delete(self): self.mox.StubOutWithMock(api, "quantum_delete_network") api.quantum_delete_network(IsA(http.HttpRequest), 'n1').AndReturn(True) self.mox.StubOutWithMock(api, 'quantum_list_networks') api.quantum_list_networks(IsA(http.HttpRequest)).\ AndReturn(self.network) self.mox.StubOutWithMock(api, 'quantum_network_details') api.quantum_network_details(IsA(http.HttpRequest), 'n1').AndReturn(self.network_details) self.mox.StubOutWithMock(api, 'quantum_list_ports') api.quantum_list_ports(IsA(http.HttpRequest), 'n1').AndReturn(self.ports) self.mox.StubOutWithMock(api, 'quantum_port_attachment') api.quantum_port_attachment(IsA(http.HttpRequest), 'n1', 'p1').AndReturn(self.port_attachment) self.mox.ReplayAll() formData = {'action': 'networks__delete__n1'} self.client.post(reverse('horizon:nova:networks:index'), formData)
def test_network_delete(self): self.mox.StubOutWithMock(api, "quantum_delete_network") api.quantum_delete_network(IsA(http.HttpRequest), 'n1').AndReturn(True) self.mox.StubOutWithMock(api, 'quantum_list_networks') api.quantum_list_networks(IsA(http.HttpRequest)).\ AndReturn(self.network) self.mox.StubOutWithMock(api, 'quantum_network_details') api.quantum_network_details(IsA(http.HttpRequest), 'n1').AndReturn(self.network_details) self.mox.StubOutWithMock(api, 'quantum_list_ports') api.quantum_list_ports(IsA(http.HttpRequest), 'n1').AndReturn(self.ports) self.mox.StubOutWithMock(api, 'quantum_port_attachment') api.quantum_port_attachment(IsA(http.HttpRequest), 'n1', 'p1').AndReturn(self.port_attachment) self.mox.ReplayAll() formData = {'network': 'n1', 'method': 'DeleteNetwork'} res = self.client.post(reverse('horizon:nova:networks:index'), formData)
def handle(self, request, data): try: LOG.info('Deleting network %s ' % data['network']) api.quantum_delete_network(request, data['network']) except Exception, e: messages.error(request, _('Unable to delete network %(network)s: %(msg)s') % {"network": data['network'], "msg": e.message})
def handle(self, request, data): try: LOG.info('Deleting network %s ' % data['network']) api.quantum_delete_network(request, data['network']) except Exception, e: if not hasattr(e, 'message'): e.message = str(e) messages.error(request, _('Unable to delete network %(network)s: %(msg)s') % {"network": data['network'], "msg": e.message})
def delete(self, request, obj_id): api.quantum_delete_network(request, obj_id)