summaryrefslogtreecommitdiff
path: root/novaclient/tests/unit/v2/test_fping.py
diff options
context:
space:
mode:
Diffstat (limited to 'novaclient/tests/unit/v2/test_fping.py')
-rw-r--r--novaclient/tests/unit/v2/test_fping.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/test_fping.py b/novaclient/tests/unit/v2/test_fping.py
new file mode 100644
index 0000000..b9ecc39
--- /dev/null
+++ b/novaclient/tests/unit/v2/test_fping.py
@@ -0,0 +1,62 @@
1# Copyright 2012 OpenStack Foundation
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 fping as data
18from novaclient.tests.unit import utils
19from novaclient.v2 import fping
20
21
22class FpingTest(utils.FixturedTestCase):
23
24 client_fixture_class = client.V1
25 data_fixture_class = data.Fixture
26
27 def test_fping_repr(self):
28 r = self.cs.fping.get(1)
29 self.assertEqual("<Fping: 1>", repr(r))
30
31 def test_list_fpings(self):
32 fl = self.cs.fping.list()
33 self.assert_called('GET', '/os-fping')
34 for f in fl:
35 self.assertIsInstance(f, fping.Fping)
36 self.assertEqual("fake-project", f.project_id)
37 self.assertEqual(True, f.alive)
38
39 def test_list_fpings_all_tenants(self):
40 fl = self.cs.fping.list(all_tenants=True)
41 for f in fl:
42 self.assertIsInstance(f, fping.Fping)
43 self.assert_called('GET', '/os-fping?all_tenants=1')
44
45 def test_list_fpings_exclude(self):
46 fl = self.cs.fping.list(exclude=['1'])
47 for f in fl:
48 self.assertIsInstance(f, fping.Fping)
49 self.assert_called('GET', '/os-fping?exclude=1')
50
51 def test_list_fpings_include(self):
52 fl = self.cs.fping.list(include=['1'])
53 for f in fl:
54 self.assertIsInstance(f, fping.Fping)
55 self.assert_called('GET', '/os-fping?include=1')
56
57 def test_get_fping(self):
58 f = self.cs.fping.get(1)
59 self.assert_called('GET', '/os-fping/1')
60 self.assertIsInstance(f, fping.Fping)
61 self.assertEqual("fake-project", f.project_id)
62 self.assertEqual(True, f.alive)