summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Lynn <ethanlynnl@vmware.com>2018-06-13 15:20:39 +0800
committerEthan Lynn <ethanlynnl@vmware.com>2018-06-13 15:20:39 +0800
commit95616621e4b0e1bd65f5a3f1f0412c859105c6a5 (patch)
tree9efb49d7ea0cf0fc89da4bd96185b5c0a155e31c
parent9f1fae3e546cb08bc6871b828cf2cd49dfe6529f (diff)
Add test_create_server
Add test_create_server Change-Id: Ib2a7d8aa878ca0e2d2c6e16937650e3e2592d6dd Issue-ID: MULTICLOUD-199 Signed-off-by: Ethan Lynn <ethanlynnl@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 5c54124..f07aa47 100644
--- a/vio/vio/tests/test_fake_nova_view.py
+++ b/vio/vio/tests/test_fake_nova_view.py
@@ -163,6 +163,24 @@ class TestFakeNovaServer(unittest.TestCase):
resp = self.view.post(req, "abcd", Server)
self.assertEqual(405, resp.status_code)
+ def test_create_server(self):
+ req = mock.Mock()
+ req.META = {
+ "HTTP_X_AUTH_TOKEN": Token
+ }
+ req.body = json.dumps({
+ "server": {
+ "name": "new_name"
+ }
+ })
+ resp = self.view.post(req, "abcd")
+ self.assertEqual(202, resp.status_code)
+ server_id = resp.data['server']['id']
+ self.assertEqual(
+ "BUILDING", fakeResponse.serverMapps[server_id]['status'])
+ self.assertEqual(
+ "new_name", fakeResponse.serverMapps[server_id]['name'])
+
class TestFakeNovaHypervisorUptime(unittest.TestCase):