summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/contrib/test_migrations.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/contrib/test_migrations.py')
-rw-r--r--novaclient/tests/unit/v2/contrib/test_migrations.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/contrib/test_migrations.py b/novaclient/tests/unit/v2/contrib/test_migrations.py
new file mode 100644
index 0000000..881fd1e
--- /dev/null
+++ b/novaclient/tests/unit/v2/contrib/test_migrations.py
@@ -0,0 +1,40 @@
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13from novaclient import extension
14from novaclient.tests.unit import utils
15from novaclient.tests.unit.v2 import fakes
16from novaclient.v2.contrib import migrations
17
18extensions = [
19 extension.Extension(migrations.__name__.split(".")[-1],
20 migrations),
21]
22cs = fakes.FakeClient(extensions=extensions)
23
24
25class MigrationsTest(utils.TestCase):
26
27 def test_list_migrations(self):
28 ml = cs.migrations.list()
29 cs.assert_called('GET', '/os-migrations')
30 for m in ml:
31 self.assertIsInstance(m, migrations.Migration)
32
33 def test_list_migrations_with_filters(self):
34 ml = cs.migrations.list('host1', 'finished', 'child1')
35
36 cs.assert_called('GET',
37 '/os-migrations?cell_name=child1&host=host1'
38 '&status=finished')
39 for m in ml:
40 self.assertIsInstance(m, migrations.Migration)