summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/test_fixed_ips.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/test_fixed_ips.py')
-rw-r--r--novaclient/tests/unit/v2/test_fixed_ips.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/test_fixed_ips.py b/novaclient/tests/unit/v2/test_fixed_ips.py
new file mode 100644
index 0000000..02ba39b
--- /dev/null
+++ b/novaclient/tests/unit/v2/test_fixed_ips.py
@@ -0,0 +1,44 @@
1# Copyright 2012 IBM Corp.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from novaclient.tests.unit.fixture_data import client
17from novaclient.tests.unit.fixture_data import fixedips as data
18from novaclient.tests.unit import utils
19
20
21class FixedIpsTest(utils.FixturedTestCase):
22
23 data_fixture_class = data.Fixture
24
25 scenarios = [('original', {'client_fixture_class': client.V1}),
26 ('session', {'client_fixture_class': client.SessionV1})]
27
28 def test_get_fixed_ip(self):
29 info = self.cs.fixed_ips.get(fixed_ip='192.168.1.1')
30 self.assert_called('GET', '/os-fixed-ips/192.168.1.1')
31 self.assertEqual('192.168.1.0/24', info.cidr)
32 self.assertEqual('192.168.1.1', info.address)
33 self.assertEqual('foo', info.hostname)
34 self.assertEqual('bar', info.host)
35
36 def test_reserve_fixed_ip(self):
37 body = {"reserve": None}
38 self.cs.fixed_ips.reserve(fixed_ip='192.168.1.1')
39 self.assert_called('POST', '/os-fixed-ips/192.168.1.1/action', body)
40
41 def test_unreserve_fixed_ip(self):
42 body = {"unreserve": None}
43 self.cs.fixed_ips.unreserve(fixed_ip='192.168.1.1')
44 self.assert_called('POST', '/os-fixed-ips/192.168.1.1/action', body)