X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=catalog%2Fpackages%2Ftests%2Ftest_nsdm_subscription.py;h=2d95a1ca7c26e7f1e220c47a0f345753c43bfff9;hb=1487db0615f16783fd01998a0f71fb2d8f97a434;hp=862054b02ab62a31de72c9ea1b822e96c6009f2d;hpb=a40cb469e3aa364fb2a0f016632bc642b4ecbdb7;p=modeling%2Fetsicatalog.git diff --git a/catalog/packages/tests/test_nsdm_subscription.py b/catalog/packages/tests/test_nsdm_subscription.py index 862054b..2d95a1c 100644 --- a/catalog/packages/tests/test_nsdm_subscription.py +++ b/catalog/packages/tests/test_nsdm_subscription.py @@ -19,6 +19,7 @@ import os from django.test import TestCase from rest_framework.test import APIClient from rest_framework import status +from requests.auth import HTTPBasicAuth from catalog.packages.biz.nsdm_subscription import NsdmSubscription from catalog.pub.database.models import NsdmSubscriptionModel @@ -33,7 +34,6 @@ from catalog.pub.utils import toscaparser class TestNsdmSubscription(TestCase): - def setUp(self): self.client = APIClient() NsdmSubscriptionModel.objects.all().delete() @@ -158,7 +158,7 @@ class TestNsdmSubscription(TestCase): response.data["callbackUri"]) expected_data = { 'status': 303, - 'detail': 'Already Subscription exists with' + 'detail': 'Subscription has already existed with' ' the same callbackUri and filter' } response = self.client.post("/api/nsd/v1/subscriptions", @@ -465,7 +465,7 @@ class TestNsdmSubscription(TestCase): expected_data = { "status": 404, "detail": "Subscription(" + self.subscription_id + ") " - "doesn't exists" + "doesn't exist" } response = self.client.get('/api/nsd/v1/' 'subscriptions/' + self.subscription_id, @@ -622,7 +622,12 @@ class TestNsdmSubscription(TestCase): } } } - mock_requests_post.assert_called_with(expect_callbackuri, data=expect_notification, headers={'Connection': 'close'}) + mock_requests_post.assert_called_with(expect_callbackuri, data=expect_notification, + auth=HTTPBasicAuth("username", "password"), + headers={'Connection': 'close', + 'content-type': 'application/json', + 'accept': 'application/json'}, + verify=False) class NotificationTest(TestCase): @@ -673,7 +678,13 @@ class NotificationTest(TestCase): } } } - mock_requests_post.assert_called_with(expect_callbackuri, data=expect_notification, headers={'Connection': 'close'}) + mock_requests_post.assert_called_with(expect_callbackuri, + data=expect_notification, + headers={'Connection': 'close', + 'content-type': 'application/json', + 'accept': 'application/json'}, + verify=False + ) @mock.patch("requests.post") @mock.patch("uuid.uuid4") @@ -709,4 +720,7 @@ class NotificationTest(TestCase): } } mock_requests_post.assert_called_with(expect_callbackuri, data=expect_notification, - headers={'Connection': 'close'}) + headers={'Connection': 'close', + 'content-type': 'application/json', + 'accept': 'application/json'}, + verify=False)