summaryrefslogtreecommitdiffstats
path: root/lcm/lcm/pub/utils/tests.py
diff options
context:
space:
mode:
authorhongyuzhao <zhao.hongyu@zte.com.cn>2019-08-13 15:21:48 +0800
committerhongyuzhao <zhao.hongyu@zte.com.cn>2019-08-16 12:04:44 +0800
commit8020d45b7bb4cd43c69425ea9c4bb1d88b250e4e (patch)
treecbd92ef641625c8e531b627dd7226a2fe0264289 /lcm/lcm/pub/utils/tests.py
parent80cb678669e138e391e5e5467bef3d5322af5cb9 (diff)
fix bug for failure in creating subscriptions for vnfm
Change-Id: I96380f38ad680079de8261d93702d67eb475f4d3 Issue-ID: VFC-1484 Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Diffstat (limited to 'lcm/lcm/pub/utils/tests.py')
-rw-r--r--lcm/lcm/pub/utils/tests.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lcm/lcm/pub/utils/tests.py b/lcm/lcm/pub/utils/tests.py
index 3a2be7a5..55553441 100644
--- a/lcm/lcm/pub/utils/tests.py
+++ b/lcm/lcm/pub/utils/tests.py
@@ -21,7 +21,7 @@ import json
from . import syscomm
from . import timeutil
from . import values
-# import platform
+import codecs
from lcm.pub.database.models import JobStatusModel, JobModel, SubscriptionModel
from lcm.pub.utils.jobutil import JobUtil
@@ -271,19 +271,19 @@ class TestNotificationUtils(unittest.TestCase):
def tearDown(self):
SubscriptionModel.objects.all().delete()
- @mock.patch('requests.post')
+ @mock.patch('httplib2.Http.request')
def test_send_notification(self, mock_post):
dummy_notification = {
- "vnfInstanceId": "99442b18-a5c7-11e8-998c-bf1755941f13",
+ "vnfInstanceId": "9fe4080c-b1a3-11e8-bb96-645106374fd3",
"operationState": "STARTING",
"operation": "INSTANTIATE",
"_links": {}
}
- mock_post.return_value.status_code = 204
+ mock_post.return_value = ({"status": "204"}, codecs.encode("1234", encoding='utf-8'))
NotificationsUtil().send_notification(dummy_notification)
mock_post.assert_called_once()
- @mock.patch('requests.post')
+ @mock.patch('httplib2.Http.request')
def test_send_notification_with_empty_filters(self, mock_post):
dummy_notification = {
"vnfInstanceId": "9fe4080c-b1a3-11e8-bb96-645106374fd3",
@@ -291,7 +291,7 @@ class TestNotificationUtils(unittest.TestCase):
"operation": "",
"_links": {}
}
- mock_post.return_value.status_code = 204
+ mock_post.return_value = ({"status": "204"}, codecs.encode("1234", encoding='utf-8'))
NotificationsUtil().send_notification(dummy_notification)
mock_post.assert_called_once()