Beispiel #1
0
 def action(self, request, obj_id):
     if self.paused:
         api.server_unpause(request, obj_id)
         self.current_past_action = UNPAUSE
     else:
         api.server_pause(request, obj_id)
         self.current_past_action = PAUSE
Beispiel #2
0
 def action(self, request, obj_id):
     if self.paused:
         api.server_unpause(request, obj_id)
         self.current_past_action = UNPAUSE
     else:
         api.server_pause(request, obj_id)
         self.current_past_action = PAUSE
Beispiel #3
0
    def test_unpause_instance(self):
        server = self.servers.first()
        server.status = "PAUSED"
        self.mox.StubOutWithMock(api, 'server_unpause')
        self.mox.StubOutWithMock(api, 'server_list')
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_unpause(IsA(http.HttpRequest), server.id)
        self.mox.ReplayAll()

        formData = {'action': 'instances__pause__%s' % server.id}
        res = self.client.post(INDEX_URL, formData)
        self.assertRedirectsNoFollow(res, INDEX_URL)
    def test_unpause_instance(self):
        server = self.servers.first()
        server.status = "PAUSED"
        self.mox.StubOutWithMock(api, 'server_unpause')
        self.mox.StubOutWithMock(api, 'server_list')
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_unpause(IsA(http.HttpRequest), server.id)
        self.mox.ReplayAll()

        formData = {'action': 'instances__pause__%s' % server.id}
        res = self.client.post(INDEX_URL, formData)
        self.assertRedirectsNoFollow(res, INDEX_URL)
Beispiel #5
0
    def test_unpause_instance_exception(self):
        server = self.servers.first()
        server.status = "PAUSED"

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_unpause(IsA(http.HttpRequest), server.id).AndRaise(self.exceptions.nova)

        self.mox.ReplayAll()

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

        self.assertRedirectsNoFollow(res, INDEX_URL)
Beispiel #6
0
    def test_unpause_instance_exception(self):
        server = self.servers.first()
        server.status = "PAUSED"

        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_unpause(IsA(http.HttpRequest), server.id) \
                          .AndRaise(self.exceptions.nova)

        self.mox.ReplayAll()

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

        self.assertRedirectsNoFollow(res, INDEX_URL)
Beispiel #7
0
    def test_unpause_instance(self):
        server = self.servers.first()
        server.status = "PAUSED"
        self.mox.StubOutWithMock(api, "volume_list")
        self.mox.StubOutWithMock(api, "server_unpause")
        self.mox.StubOutWithMock(api, "server_list")
        self.mox.StubOutWithMock(api, "flavor_list")
        api.flavor_list(IsA(http.HttpRequest)).AndReturn(self.flavors.list())
        api.volume_list(IsA(http.HttpRequest)).AndReturn(self.volumes.list())
        api.server_list(IsA(http.HttpRequest)).AndReturn(self.servers.list())
        api.server_unpause(IsA(http.HttpRequest), server.id)
        self.mox.ReplayAll()

        formData = {"action": "instances__pause__%s" % server.id}
        res = self.client.post(INDEX_URL, formData)
        self.assertRedirectsNoFollow(res, INDEX_URL)
Beispiel #8
0
 def action(self, request, obj_id):
     if getattr(self, 'paused', False):
         api.server_pause(request, obj_id)
     else:
         api.server_unpause(request, obj_id)
Beispiel #9
0
 def action(self, request, obj_id):
     if getattr(self, 'paused', False):
         api.server_pause(request, obj_id)
     else:
         api.server_unpause(request, obj_id)