Esempio n. 1
0
    def test_reboot_instance(self):
        formData = {'method': 'RebootInstance',
                    'instance': self.servers[0].id,
                    }

        self.mox.StubOutWithMock(api, 'server_reboot')
        api.server_reboot(IsA(http.HttpRequest), unicode(self.servers[0].id))

        self.mox.ReplayAll()

        res = self.client.post(
                reverse('steer:engine:instances_and_volumes:instances:index'),
                        formData)

        self.assertRedirectsNoFollow(res,
                reverse('steer:engine:instances_and_volumes:instances:index'))
Esempio n. 2
0
    def test_reboot_instance(self):
        formData = {
            'method': 'RebootInstance',
            'instance': self.servers[0].id,
        }

        self.mox.StubOutWithMock(api, 'server_reboot')
        api.server_reboot(IsA(http.HttpRequest), unicode(self.servers[0].id))

        self.mox.ReplayAll()

        res = self.client.post(
            reverse('steer:engine:instances_and_volumes:instances:index'),
            formData)

        self.assertRedirectsNoFollow(
            res, reverse('steer:engine:instances_and_volumes:instances:index'))
Esempio n. 3
0
 def handle(self, request, data):
     instance_id = data['instance']
     try:
         server = api.server_reboot(request, instance_id)
         messages.success(request, _("Instance rebooting"))
     except api_exceptions.ApiException, e:
         LOG.exception(_('ApiException while rebooting instance "%s"') %
                   instance_id)
         messages.error(request,
                    _('Unable to reboot instance: %s') % e.message)
Esempio n. 4
0
    def test_reboot_instance_exception(self):
        formData = {'method': 'RebootInstance',
                    'instance': self.servers[0].id,
                    }

        self.mox.StubOutWithMock(api, 'server_reboot')
        exception = api_exceptions.ApiException('ApiException',
                                                message='apiException')
        api.server_reboot(IsA(http.HttpRequest),
                          unicode(self.servers[0].id)).AndRaise(exception)

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

        self.mox.ReplayAll()

        res = self.client.post(
                reverse('steer:engine:instances_and_volumes:instances:index'),
                        formData)

        self.assertRedirectsNoFollow(res,
                reverse('steer:engine:instances_and_volumes:instances:index'))
Esempio n. 5
0
    def test_reboot_instance_exception(self):
        formData = {
            'method': 'RebootInstance',
            'instance': self.servers[0].id,
        }

        self.mox.StubOutWithMock(api, 'server_reboot')
        exception = api_exceptions.ApiException('ApiException',
                                                message='apiException')
        api.server_reboot(IsA(http.HttpRequest),
                          unicode(self.servers[0].id)).AndRaise(exception)

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

        self.mox.ReplayAll()

        res = self.client.post(
            reverse('steer:engine:instances_and_volumes:instances:index'),
            formData)

        self.assertRedirectsNoFollow(
            res, reverse('steer:engine:instances_and_volumes:instances:index'))