summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/contrib/test_baremetal.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/contrib/test_baremetal.py')
-rw-r--r--novaclient/tests/unit/v2/contrib/test_baremetal.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/contrib/test_baremetal.py b/novaclient/tests/unit/v2/contrib/test_baremetal.py
new file mode 100644
index 0000000..a5ee414
--- /dev/null
+++ b/novaclient/tests/unit/v2/contrib/test_baremetal.py
@@ -0,0 +1,64 @@
1# Copyright 2013 Hewlett-Packard Development Company, L.P.
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
16
17from novaclient import extension
18from novaclient.tests.unit import utils
19from novaclient.tests.unit.v2.contrib import fakes
20from novaclient.v2.contrib import baremetal
21
22
23extensions = [
24 extension.Extension(baremetal.__name__.split(".")[-1], baremetal),
25]
26cs = fakes.FakeClient(extensions=extensions)
27
28
29class BaremetalExtensionTest(utils.TestCase):
30
31 def test_list_nodes(self):
32 nl = cs.baremetal.list()
33 cs.assert_called('GET', '/os-baremetal-nodes')
34 for n in nl:
35 self.assertIsInstance(n, baremetal.BareMetalNode)
36
37 def test_get_node(self):
38 n = cs.baremetal.get(1)
39 cs.assert_called('GET', '/os-baremetal-nodes/1')
40 self.assertIsInstance(n, baremetal.BareMetalNode)
41
42 def test_create_node(self):
43 n = cs.baremetal.create("service_host", 1, 1024, 2048,
44 "aa:bb:cc:dd:ee:ff")
45 cs.assert_called('POST', '/os-baremetal-nodes')
46 self.assertIsInstance(n, baremetal.BareMetalNode)
47
48 def test_delete_node(self):
49 n = cs.baremetal.get(1)
50 cs.baremetal.delete(n)
51 cs.assert_called('DELETE', '/os-baremetal-nodes/1')
52
53 def test_node_add_interface(self):
54 i = cs.baremetal.add_interface(1, "bb:cc:dd:ee:ff:aa", 1, 2)
55 cs.assert_called('POST', '/os-baremetal-nodes/1/action')
56 self.assertIsInstance(i, baremetal.BareMetalNodeInterface)
57
58 def test_node_remove_interface(self):
59 cs.baremetal.remove_interface(1, "bb:cc:dd:ee:ff:aa")
60 cs.assert_called('POST', '/os-baremetal-nodes/1/action')
61
62 def test_node_list_interfaces(self):
63 cs.baremetal.list_interfaces(1)
64 cs.assert_called('GET', '/os-baremetal-nodes/1')