summaryrefslogtreecommitdiffstats
path: root/newton
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-27 16:14:31 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-27 16:14:31 +0800
commitbd3506cb1bf1b65c89efb822f8b43c314a153f82 (patch)
treed0bde946661e41010c0d0ec76d4014142a39d9e9 /newton
parent6df44251c333a0ae9df439e234542e676b4470d5 (diff)
Fix UT bug in test-vport
Change-Id: Ide8564230765d8a060bc812c3ee0e48a317c9436 Issue-ID: MULTICLOUD-203 Signed-off-by: Yun Huang <yun.huang@windriver.com>
Diffstat (limited to 'newton')
-rw-r--r--newton/newton/requests/tests/test_vport.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/newton/newton/requests/tests/test_vport.py b/newton/newton/requests/tests/test_vport.py
index 08f6af69..d407dac0 100644
--- a/newton/newton/requests/tests/test_vport.py
+++ b/newton/newton/requests/tests/test_vport.py
@@ -13,6 +13,7 @@
# limitations under the License.
import mock
+import json
from rest_framework import status
@@ -121,7 +122,9 @@ class Testvports(test_base.TestRequest):
response = self.client.post(
self.url + "ports",
- MOCK_POST_VPORT_REQUEST, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+ data=json.dumps(MOCK_POST_VPORT_REQUEST),
+ content_type='application/json',
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@@ -143,7 +146,9 @@ class Testvports(test_base.TestRequest):
response = self.client.post(
self.url + "ports",
- MOCK_POST_VPORT_REQUEST_EXISTING, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+ data=json.dumps(MOCK_POST_VPORT_REQUEST_EXISTING),
+ content_type='application/json',
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
self.assertEquals(status.HTTP_200_OK, response.status_code)
@@ -165,7 +170,9 @@ class Testvports(test_base.TestRequest):
response = self.client.post(
self.url + "ports",
- {}, HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
+ {},
+ content_type='application/json',
+ HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
context = response.json()
self.assertIn('error', context)