Ejemplo n.º 1
0
 def action(self, request, obj_id):
     if self.suspended:
         api.server_resume(request, obj_id)
         self.current_past_action = RESUME
     else:
         api.server_suspend(request, obj_id)
         self.current_past_action = SUSPEND
Ejemplo n.º 2
0
 def action(self, request, obj_id):
     if self.suspended:
         api.server_resume(request, obj_id)
         self.current_past_action = RESUME
     else:
         api.server_suspend(request, obj_id)
         self.current_past_action = SUSPEND
Ejemplo n.º 3
0
    def test_suspend_instance(self):
        server = self.servers.first()

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_suspend(IsA(http.HttpRequest), unicode(server.id))

        self.mox.ReplayAll()

        formData = {'action': 'instances__suspend__%s' % server.id}
        res = self.client.post(INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, INDEX_URL)
Ejemplo n.º 4
0
    def test_suspend_instance(self):
        server = self.servers.first()

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_suspend(IsA(http.HttpRequest), unicode(server.id))

        self.mox.ReplayAll()

        formData = {'action': 'instances__suspend__%s' % server.id}
        res = self.client.post(INDEX_URL, formData)

        self.assertRedirectsNoFollow(res, INDEX_URL)