summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-04-08 17:14:39 +0800
committerBin Sun <bins@vmware.com>2018-04-08 17:15:05 +0800
commit0da31c84e1780e040fe46517c008d73a082b29d9 (patch)
treedc2d59bc779f7d20a1b3b8df07c89d2ce377203b
parent48254c4ed51d68408cbee5bd0cd921e2a1af1fc3 (diff)
Add fake get hypervisor test
Change-Id: Iee199aba518acdffdfb33fb54cbc060ce6cfbd35 Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun <bins@vmware.com>
-rw-r--r--vio/vio/tests/test_fake_nova_view.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/vio/vio/tests/test_fake_nova_view.py b/vio/vio/tests/test_fake_nova_view.py
index 89e1bc8..e01e26e 100644
--- a/vio/vio/tests/test_fake_nova_view.py
+++ b/vio/vio/tests/test_fake_nova_view.py
@@ -50,3 +50,21 @@ class TestFakeNovaServer(unittest.TestCase):
mock_delete_server.return_value = {}
resp = self.view.delete(req, "abcd", Server)
self.assertEqual(204, resp.status_code)
+
+
+class TestFakeNovaHypervisors(unittest.TestCase):
+
+ def setUp(self):
+ self.view = views.FakeNovaHypervisors()
+
+ @mock.patch.object(fakeResponse, "get_oshypervisor")
+ def test_get_server(self, mock_get_oshypervisor):
+ req = mock.Mock()
+ req.META = {
+ "HTTP_X_AUTH_TOKEN": Token
+ }
+ mock_get_oshypervisor.return_value = {
+ "hypervisor": "1234abcd"
+ }
+ resp = self.view.get(req, "abcd")
+ self.assertEqual(200, resp.status_code)