예제 #1
0
 def test_server_soft_reboot(self):
     self.mock_server_reboot.return_value = None
     request = self.mock_rest_request(body='{"operation": "soft_reboot"}')
     response = nova.Server().post(request, 'MegaMan')
     self.assertStatusCode(response, 204)
     self.mock_server_reboot.assert_called_once_with(
         request, 'MegaMan', True)
예제 #2
0
    def test_server_get_single(self, nc):
        request = self.mock_rest_request()
        nc.server_get.return_value.to_dict.return_value = {'name': '1'}

        response = nova.Server().get(request, "1")
        self.assertStatusCode(response, 200)
        nc.server_get.assert_called_once_with(request, "1")
예제 #3
0
 def test_server_resume(self, nc):
     request = self.mock_rest_request(body='{"operation": "resume"}')
     response = nova.Server().post(request, 'MegaMan')
     self.assertStatusCode(response, 200)
     nc.server_resume.assert_called_once_with(request, 'MegaMan')
예제 #4
0
 def test_server_unpause(self):
     self.mock_server_unpause.return_value = None
     request = self.mock_rest_request(body='{"operation": "unpause"}')
     response = nova.Server().post(request, 'MegaMan')
     self.assertStatusCode(response, 204)
     self.mock_server_unpause.assert_called_once_with(request, 'MegaMan')