summaryrefslogtreecommitdiffstats
path: root/share/newton_base
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-28 00:09:35 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-28 00:09:35 +0800
commit827585f169b1c97bf58dd237246515ebe42e1cfc (patch)
tree02679feddc8d244dcc4fedccbbf75fcee4de8e33 /share/newton_base
parentce8e69f4aa4996d5f650a81fe26251f9fe44992b (diff)
Fix UT bug in test-base
Change-Id: I2a281dd186f2771497289401186bfd31912b568a Issue-ID: MULTICLOUD-203 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'share/newton_base')
-rw-r--r--share/newton_base/tests/test_base.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/share/newton_base/tests/test_base.py b/share/newton_base/tests/test_base.py
index 1b582ef4..15160d06 100644
--- a/share/newton_base/tests/test_base.py
+++ b/share/newton_base/tests/test_base.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import json
import mock
from rest_framework import status
import unittest
@@ -171,7 +172,9 @@ class AbstractTestResource(object):
mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO
response = self.client.post(
- self.url, self.MOCK_POST_RESOURCE_REQUEST,
+ self.url,
+ data=json.dumps(self.MOCK_POST_RESOURCE_REQUEST),
+ content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
@@ -197,7 +200,9 @@ class AbstractTestResource(object):
mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO
response = self.client.post(
- self.url, self.MOCK_POST_RESOURCE_REQUEST_EXISTING,
+ self.url,
+ data=json.dumps(self.MOCK_POST_RESOURCE_REQUEST_EXISTING),
+ content_type='application/json',
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
@@ -222,7 +227,10 @@ class AbstractTestResource(object):
mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO
response = self.client.post(
- self.url, {}, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+ self.url,
+ {},
+ content_type='application/json',
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
self.assertIn('error', context)