Пример #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
Пример #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
Пример #3
0
    def test_resume_instance(self):
        server = self.servers.first()
        server.status = "SUSPENDED"

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_resume(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)
Пример #4
0
    def test_resume_instance(self):
        server = self.servers.first()
        server.status = "SUSPENDED"

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_resume(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)