summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Sun <bins@vmware.com>2018-04-11 10:51:20 +0800
committerBin Sun <bins@vmware.com>2018-04-11 10:53:25 +0800
commit107d08f19a6a8f96b0c6d4066fe6d2fd0caffe80 (patch)
tree392e38d112f26c6f3f70ea3f138e6e85bb55db80
parentebf932180888db33f2de110ad062fafa78a8a33d (diff)
Add fake create stack test
Change-Id: Ifdae0e219cb9f6d1b8c6cdddf34e53bf8b7d4d0f Issue-ID: MULTICLOUD-199 Signed-off-by: Bin Sun <bins@vmware.com>
-rw-r--r--vio/vio/tests/test_fake_heat_view.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/vio/vio/tests/test_fake_heat_view.py b/vio/vio/tests/test_fake_heat_view.py
index 4a3d752..56a8270 100644
--- a/vio/vio/tests/test_fake_heat_view.py
+++ b/vio/vio/tests/test_fake_heat_view.py
@@ -48,7 +48,7 @@ class TestFakeHeatServicePreview(unittest.TestCase):
def setUp(self):
self.view = views.FakeHeatServicePreview()
- @mock.patch.object(fakeResponse, "upload_image")
+ @mock.patch.object(fakeResponse, "createStackPreview")
def test_create_service_preview(self, mock_createStackPreview):
req = mock.Mock()
req.META = {
@@ -78,3 +78,16 @@ class TestFakeHeatService(unittest.TestCase):
}
resp = self.view.get(req, "1234abcd", STACK_NAME, STACK_ID)
self.assertEqual(200, resp.status_code)
+
+ @mock.patch.object(fakeResponse, "createStack")
+ def test_create_service_preview(self, mock_createStack):
+ req = mock.Mock()
+ req.META = {
+ "HTTP_X_AUTH_TOKEN": Token
+ }
+ req.body = json.dumps({"stack_name": STACK_NAME})
+ mock_createStack.return_value = {
+ "stack": "stack1"
+ }
+ resp = self.view.post(req, "1234abcd")
+ self.assertEqual(201, resp.status_code)