blob: 83fe461e32f5838a3ce943580db79d4a0859de39 [file] [log] [blame]
md nadeemdaca4192015-08-26 12:56:38 +05301# Copyright 2015 NEC Corporation. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.services.compute.json import migrations_client
16from tempest.tests import fake_auth_provider
17from tempest.tests.services.compute import base
18
19
20class TestMigrationsClient(base.BaseComputeServiceTest):
21 FAKE_MIGRATION_INFO = {"migrations": [{
22 "created_at": "2012-10-29T13:42:02",
23 "dest_compute": "compute2",
24 "dest_host": "1.2.3.4",
25 "dest_node": "node2",
26 "id": 1234,
27 "instance_uuid": "e9e4fdd7-f956-44ff-bfeb-d654a96ab3a2",
28 "new_instance_type_id": 2,
29 "old_instance_type_id": 1,
30 "source_compute": "compute1",
31 "source_node": "node1",
32 "status": "finished",
33 "updated_at": "2012-10-29T13:42:02"}]}
34
35 def setUp(self):
36 super(TestMigrationsClient, self).setUp()
37 fake_auth = fake_auth_provider.FakeAuthProvider()
38 self.mg_client_obj = migrations_client.MigrationsClient(
39 fake_auth, 'compute', 'regionOne')
40
41 def _test_list_migrations(self, bytes_body=False):
42 self.check_service_client_function(
43 self.mg_client_obj.list_migrations,
44 'tempest.common.service_client.ServiceClient.get',
45 self.FAKE_MIGRATION_INFO,
46 bytes_body)
47
48 def test_list_migration_with_str_body(self):
49 self._test_list_migrations()
50
51 def test_list_migration_with_bytes_body(self):
52 self._test_list_migrations(True)