diff options
-rw-r--r-- | multivimbroker/multivimbroker/forwarder/views.py | 6 | ||||
-rw-r--r-- | multivimbroker/multivimbroker/tests/test_check_capacity.py | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/multivimbroker/multivimbroker/forwarder/views.py b/multivimbroker/multivimbroker/forwarder/views.py index 19e69f0..0219dd4 100644 --- a/multivimbroker/multivimbroker/forwarder/views.py +++ b/multivimbroker/multivimbroker/forwarder/views.py @@ -114,7 +114,8 @@ class CheckCapacity(BaseServer): for vim in body.get("VIMs", []): url = request.get_full_path().replace( "check_vim_capacity", "%s/capacity_check" % vim) - resp = self.send(vim, url, json.dumps(newbody), "POST") + resp = self.send(vim, url, json.dumps(newbody), "POST", + headers=originHeaders(request)) if int(resp.status_code) != status.HTTP_200_OK: continue try: @@ -224,7 +225,8 @@ class APIv1CheckCapacity(CheckCapacity): "check_vim_capacity", "%s/%s/capacity_check" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - resp = self.send(vimid, url, json.dumps(newbody), "POST") + resp = self.send(vimid, url, json.dumps(newbody), "POST", + headers=originHeaders(request)) if int(resp.status_code) != status.HTTP_200_OK: continue try: diff --git a/multivimbroker/multivimbroker/tests/test_check_capacity.py b/multivimbroker/multivimbroker/tests/test_check_capacity.py index d7a7cae..64691e7 100644 --- a/multivimbroker/multivimbroker/tests/test_check_capacity.py +++ b/multivimbroker/multivimbroker/tests/test_check_capacity.py @@ -38,6 +38,7 @@ class CheckCapacityTest(unittest.TestCase): }""" req.get_full_path.return_value = ("http://msb.onap.org/api/multicloud" "/v0/check_vim_capacity") + req.META.items.return_value = [("Project", "projectname1")] with mock.patch.object(self.view, "send") as send: plugin_resp = mock.Mock() plugin_resp.content = """{ @@ -64,6 +65,8 @@ class CheckCapacityTest(unittest.TestCase): }""" req.get_full_path.return_value = ("http://msb.onap.org/api/multicloud" "/v0/check_vim_capacity") + req.META.items.return_value = [("Project", "projectname1")] + with mock.patch.object(self.view, "send") as send: plugin_resp = mock.Mock() plugin_resp.content = """{ @@ -84,6 +87,7 @@ class CheckCapacityTest(unittest.TestCase): req.body = "hello world" req.get_full_path.return_value = ("http://msb.onap.org/api/multicloud" "/v0/check_vim_capacity") + req.META.items.return_value = [("Project", "projectname1")] expect_body = { "error": ("Invalidate request body " "No JSON object could be decoded.") |