Beispiel #1
0
    def test_delete_group_exception(self):
        exception = novaclient_exceptions.ClientException(
            'ClientException', message='ClientException')

        SECGROUP_ID = '1'

        formData = {
            'method': 'DeleteGroup',
            'tenant_id': self.TEST_TENANT,
            'security_group_id': SECGROUP_ID,
        }

        self.mox.StubOutWithMock(api, 'security_group_delete')
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID).\
                                  AndRaise(exception)

        self.mox.StubOutWithMock(messages, 'error')
        messages.error(IsA(http.HttpRequest), IsA(str))

        self.mox.ReplayAll()

        res = self.client.post(
            reverse('dash_security_groups', args=[self.TEST_TENANT]), formData)

        self.assertRedirectsNoFollow(
            res, reverse('dash_security_groups', args=[self.TEST_TENANT]))

        self.mox.VerifyAll()
    def test_delete_group_exception(self):
        exception = novaclient_exceptions.ClientException('ClientException',
                                                  message='ClientException')

        SECGROUP_ID = '1'

        formData = {'method': 'DeleteGroup',
                    'tenant_id': self.TEST_TENANT,
                    'security_group_id': SECGROUP_ID,
                   }

        self.mox.StubOutWithMock(api, 'security_group_delete')
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID).\
                                  AndRaise(exception)

        self.mox.StubOutWithMock(messages, 'error')
        messages.error(IsA(http.HttpRequest), IsA(basestring))

        self.mox.ReplayAll()

        res = self.client.post(reverse('dash_security_groups',
                                       args=[self.TEST_TENANT]),
                                       formData)

        self.assertRedirectsNoFollow(res, reverse('dash_security_groups',
                                          args=[self.TEST_TENANT]))

        self.mox.VerifyAll()
    def handle(self, request, data):
        try:
            LOG.info('Delete security_group: "%s"' % data)

            security_group = api.security_group_delete(request, data["security_group_id"])
            messages.info(request, "Successfully deleted security_group: %s" % data["security_group_id"])
        except novaclient_exceptions.ClientException, e:
            LOG.exception("ClientException in DeleteGroup")
            messages.error(request, "Error deleting security group: %s" % e.message)
    def test_delete_group(self):
        SECGROUP_ID = "1"

        formData = {"method": "DeleteGroup", "tenant_id": self.TEST_TENANT, "security_group_id": SECGROUP_ID}

        self.mox.StubOutWithMock(api, "security_group_delete")
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID)

        self.mox.StubOutWithMock(messages, "info")
        messages.info(IsA(http.HttpRequest), IsA(unicode))

        self.mox.ReplayAll()

        res = self.client.post(reverse("dash_security_groups", args=[self.TEST_TENANT]), formData)

        self.assertRedirectsNoFollow(res, reverse("dash_security_groups", args=[self.TEST_TENANT]))

        self.mox.VerifyAll()
    def test_delete_group_exception(self):
        exception = novaclient_exceptions.ClientException("ClientException", message="ClientException")

        SECGROUP_ID = "1"

        formData = {"method": "DeleteGroup", "tenant_id": self.TEST_TENANT, "security_group_id": SECGROUP_ID}

        self.mox.StubOutWithMock(api, "security_group_delete")
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID).AndRaise(exception)

        self.mox.StubOutWithMock(messages, "error")
        messages.error(IsA(http.HttpRequest), IsA(str))

        self.mox.ReplayAll()

        res = self.client.post(reverse("dash_security_groups", args=[self.TEST_TENANT]), formData)

        self.assertRedirectsNoFollow(res, reverse("dash_security_groups", args=[self.TEST_TENANT]))

        self.mox.VerifyAll()
Beispiel #6
0
    def handle(self, request, data):
        try:
            LOG.info('Delete security_group: "%s"' % data)

            security_group = api.security_group_delete(
                request, data['security_group_id'])
            messages.info(request, 'Successfully deleted security_group: %s' \
                                    % data['security_group_id'])
        except novaclient_exceptions.ClientException, e:
            LOG.error("ClientException in DeleteGroup", exc_info=True)
            messages.error(request,
                           'Error deleting security group: %s' % e.message)
    def handle(self, request, data):
        try:
            LOG.info('Delete security_group: "%s"' % data)

            security_group = api.security_group_delete(request,
                                                     data['security_group_id'])
            messages.info(request, 'Successfully deleted security_group: %s' \
                                    % data['security_group_id'])
        except novaclient_exceptions.ClientException, e:
            LOG.error("ClientException in DeleteGroup", exc_info=True)
            messages.error(request, 'Error deleting security group: %s'
                                     % e.message)
Beispiel #8
0
    def test_delete_group(self):
        SECGROUP_ID = '1'

        formData = {
            'method': 'DeleteGroup',
            'tenant_id': self.TEST_TENANT,
            'security_group_id': SECGROUP_ID,
        }

        self.mox.StubOutWithMock(api, 'security_group_delete')
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID)

        self.mox.StubOutWithMock(messages, 'info')
        messages.info(IsA(http.HttpRequest), IsA(unicode))

        self.mox.ReplayAll()

        res = self.client.post(
            reverse('dash_security_groups', args=[self.TEST_TENANT]), formData)

        self.assertRedirectsNoFollow(
            res, reverse('dash_security_groups', args=[self.TEST_TENANT]))

        self.mox.VerifyAll()
    def test_delete_group(self):
        SECGROUP_ID = '1'

        formData = {'method': 'DeleteGroup',
                    'tenant_id': self.TEST_TENANT,
                    'security_group_id': SECGROUP_ID,
                   }

        self.mox.StubOutWithMock(api, 'security_group_delete')
        api.security_group_delete(IsA(http.HttpRequest), SECGROUP_ID)

        self.mox.StubOutWithMock(messages, 'info')
        messages.info(IsA(http.HttpRequest), IsA(unicode))

        self.mox.ReplayAll()

        res = self.client.post(reverse('dash_security_groups',
                                       args=[self.TEST_TENANT]),
                                       formData)

        self.assertRedirectsNoFollow(res, reverse('dash_security_groups',
                                          args=[self.TEST_TENANT]))

        self.mox.VerifyAll()