summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Ke <lokyse@163.com>2018-07-04 03:07:37 +0000
committerGerrit Code Review <gerrit@onap.org>2018-07-04 03:07:37 +0000
commitb9f979305f530155d25a70de5d62f791c2850ed8 (patch)
tree3b28cf1ed99a16f0cf2f35c251d3ed07b4fd1bee
parent65ab9ae82daf0e0522a7fbf1fbd556dc5abea9fe (diff)
parent9e63b89acf9acdc4afed49b453a5047aa5d28be4 (diff)
Merge changes from topic 'ut3'
* changes: Add test_operate_server_unpause Add test_operate_server_suspend
-rw-r--r--vio/vio/tests/test_fake_nova_view.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/vio/vio/tests/test_fake_nova_view.py b/vio/vio/tests/test_fake_nova_view.py
index 3d322cd..b97435a 100644
--- a/vio/vio/tests/test_fake_nova_view.py
+++ b/vio/vio/tests/test_fake_nova_view.py
@@ -112,6 +112,33 @@ class TestFakeNovaServer(unittest.TestCase):
self.assertEqual(
"ACTIVE", fakeResponse.serverMapps[Server]['status'])
+ def test_operate_server_suspend(self):
+ req = mock.Mock()
+ req.META = {
+ "HTTP_X_AUTH_TOKEN": Token
+ }
+ req.body = json.dumps({
+ "suspend": {}
+ })
+ resp = self.view.post(req, "abcd", Server)
+ self.assertEqual(202, resp.status_code)
+ self.assertEqual(
+ "SUSPENDED", fakeResponse.serverMapps[Server]['status'])
+
+ def test_operate_server_unpause(self):
+ req = mock.Mock()
+ req.META = {
+ "HTTP_X_AUTH_TOKEN": Token
+ }
+ req.body = json.dumps({
+ "unpause": {}
+ })
+ fakeResponse.serverMapps[Server]['status'] = "PAUSED"
+ resp = self.view.post(req, "abcd", Server)
+ self.assertEqual(202, resp.status_code)
+ self.assertEqual(
+ "ACTIVE", fakeResponse.serverMapps[Server]['status'])
+
class TestFakeNovaHypervisors(unittest.TestCase):