blob: 55f2ef2030d84095277d4e36c6c1094600b83840 [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
Ken'ichi Ohmichi50f82952015-09-14 17:04:46 +000015from tempest_lib.tests import fake_auth_provider
16
md nadeemdaca4192015-08-26 12:56:38 +053017from tempest.services.compute.json import migrations_client
md nadeemdaca4192015-08-26 12:56:38 +053018from tempest.tests.services.compute import base
19
20
21class TestMigrationsClient(base.BaseComputeServiceTest):
22 FAKE_MIGRATION_INFO = {"migrations": [{
23 "created_at": "2012-10-29T13:42:02",
24 "dest_compute": "compute2",
25 "dest_host": "1.2.3.4",
26 "dest_node": "node2",
27 "id": 1234,
28 "instance_uuid": "e9e4fdd7-f956-44ff-bfeb-d654a96ab3a2",
29 "new_instance_type_id": 2,
30 "old_instance_type_id": 1,
31 "source_compute": "compute1",
32 "source_node": "node1",
33 "status": "finished",
34 "updated_at": "2012-10-29T13:42:02"}]}
35
36 def setUp(self):
37 super(TestMigrationsClient, self).setUp()
38 fake_auth = fake_auth_provider.FakeAuthProvider()
39 self.mg_client_obj = migrations_client.MigrationsClient(
40 fake_auth, 'compute', 'regionOne')
41
42 def _test_list_migrations(self, bytes_body=False):
43 self.check_service_client_function(
44 self.mg_client_obj.list_migrations,
45 'tempest.common.service_client.ServiceClient.get',
46 self.FAKE_MIGRATION_INFO,
47 bytes_body)
48
49 def test_list_migration_with_str_body(self):
50 self._test_list_migrations()
51
52 def test_list_migration_with_bytes_body(self):
53 self._test_list_migrations(True)