Beispiel #1
0
    def handle(self, request, data):
        network_name = data['name']

        try:
            LOG.info('Creating network %s ' % network_name)
            send_data = {'network': {'name': '%s' % network_name}}
            api.quantum_create_network(request, send_data)
        except Exception, e:
            messages.error(request,
                           _('Unable to create network %(network)s: %(msg)s') %
                           {"network": network_name, "msg": e.message})
            return shortcuts.redirect(request.build_absolute_uri())
Beispiel #2
0
    def handle(self, request, data):
        network_name = data['name']

        try:
            LOG.info('Creating network %s ' % network_name)
            send_data = {'network': {'name': '%s' % network_name}}
            api.quantum_create_network(request, send_data)
        except Exception, e:
            messages.error(
                request, 'Unable to create network %s: %s' % (
                    network_name,
                    e.message,
                ))
            return shortcuts.redirect(request.build_absolute_uri())
Beispiel #3
0
    def test_network_create(self):
        self.mox.StubOutWithMock(api, "quantum_create_network")
        api.quantum_create_network(IsA(http.HttpRequest), dict).AndReturn(True)

        self.mox.ReplayAll()

        formData = {'name': 'Test', 'method': 'CreateNetwork'}

        res = self.client.post(
            reverse('dash_network_create', args=[self.request.user.tenant_id]),
            formData)

        self.assertRedirectsNoFollow(
            res, reverse('dash_networks', args=[self.request.user.tenant_id]))
        self.mox.VerifyAll()
    def test_network_create(self):
        self.mox.StubOutWithMock(api, "quantum_create_network")
        api.quantum_create_network(IsA(http.HttpRequest), dict).AndReturn(True)

        self.mox.ReplayAll()

        formData = {'name': 'Test',
                    'method': 'CreateNetwork'}

        res = self.client.post(reverse('dash_network_create',
                               args=[self.request.user.tenant]),
                               formData)

        self.assertRedirectsNoFollow(res, reverse('dash_networks',
                                          args=[self.request.user.tenant]))
        self.mox.VerifyAll()