aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-16 01:35:48 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-16 01:35:48 -0700
commit18c479f0b09bb406c21c707bf7acc03fc34ef0a0 (patch)
tree3e1b06fa0079d612c2889e148bc882b3ef7dd38b /test/mocks
parent6049499c5a17cfa58f351b3731837463b7359047 (diff)
Return http 404 for wrong prefix, not 401
The correct http code for wrong REST API url should be http "404 Not Found", not "401 Unauthorized". Change-Id: I78710fcd4c43926dbba3227c4099bf6239095f19 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks')
-rw-r--r--test/mocks/prov-mns-provider/src/ProvMnSProvider.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/mocks/prov-mns-provider/src/ProvMnSProvider.py b/test/mocks/prov-mns-provider/src/ProvMnSProvider.py
index e9d488ede..da445e223 100644
--- a/test/mocks/prov-mns-provider/src/ProvMnSProvider.py
+++ b/test/mocks/prov-mns-provider/src/ProvMnSProvider.py
@@ -83,10 +83,11 @@ class ServerHTTP(BaseHTTPRequestHandler):
print("Fail to get MOI object: "+'/' +className+'/'+idName)
self.send_response(406)
else:
- self.send_response(401)
if prefix_check is True:
+ self.send_response(401)
response['error'] = {"errorInfo":"not Authorized"}
else:
+ self.send_response(404)
response['error'] = {"errorInfo":"wrong prefix"}
self.send_header("Content-type","application/json")
self.end_headers()
@@ -151,10 +152,11 @@ class ServerHTTP(BaseHTTPRequestHandler):
print("Fail to modify MOI object: "+'/' +className+'/'+idName)
self.send_response(406)
else:
- self.send_response(401)
if prefix_check is True:
+ self.send_response(401)
response['error'] = {"errorInfo":"not Authorized"}
else:
+ self.send_response(404)
response['error'] = {"errorInfo":"wrong prefix"}
self.send_header("Content-type","application/json")
self.end_headers()
@@ -203,10 +205,11 @@ class ServerHTTP(BaseHTTPRequestHandler):
print("Fail to delete MOI object: "+'/' +className+'/'+idName)
self.send_response(406)
else:
- self.send_response(401)
if prefix_check is True:
+ self.send_response(401)
response['error'] = {"errorInfo":"not Authorized"}
else:
+ self.send_response(404)
response['error'] = {"errorInfo":"wrong prefix"}
self.send_header("Content-type","application/json")
self.end_headers()
@@ -252,10 +255,11 @@ class ServerHTTP(BaseHTTPRequestHandler):
print("Fail to create MOI object: "+'/' +className+'/'+idName)
self.send_response(406)
else:
- self.send_response(401)
if prefix_check is True:
+ self.send_response(401)
response['error'] = {"errorInfo":"not Authorized"}
else:
+ self.send_response(404)
response['error'] = {"errorInfo":"wrong prefix"}
self.send_header("Content-type","application/json")
self.end_headers()