aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/prov-mns-provider
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/prov-mns-provider')
-rw-r--r--test/mocks/prov-mns-provider/src/tests/common.py5
-rw-r--r--test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py25
2 files changed, 30 insertions, 0 deletions
diff --git a/test/mocks/prov-mns-provider/src/tests/common.py b/test/mocks/prov-mns-provider/src/tests/common.py
index 2ffe8acba..a78e9f540 100644
--- a/test/mocks/prov-mns-provider/src/tests/common.py
+++ b/test/mocks/prov-mns-provider/src/tests/common.py
@@ -22,4 +22,9 @@ URI_GET_STRING = URI_BASE_STRING + '?scope=BASE_ONLY&filter=' + MOI_CLASS + \
'&fields=gNBId&fields=gNBIdLength'
URI_PATCH_STRING = URI_BASE_STRING + '?scope=BASE_ONLY&filter=' + MOI_CLASS
URI_DELETE_STRING = URI_PATCH_STRING
+BAD_CLASS_URI_BASE_STRING = URI_SCHEMA + '://' + ProvMnSProvider.ipAddress + \
+ ':' + str(ProvMnSProvider.portNumber) + \
+ ProvMnSProvider.prefix + '/' + 'invalidMoiClass' + \
+ '/' + MOI_ID
UNAUTHORIZED_MSG="not Authorized"
+INVALID_CLASS_MSG = "MOI class not support"
diff --git a/test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py b/test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py
index 660f26c64..08e0e3299 100644
--- a/test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py
+++ b/test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py
@@ -22,3 +22,28 @@ def test_unauthorized():
auth=INVALID_AUTH_STRING)
assert req.status_code == requests.codes.unauthorized
assert UNAUTHORIZED_MSG in req.text
+
+def test_bad_moi_class():
+ '''Check service returns proper
+ http code and error msg if MOI class
+ is invalid'''
+
+ req = requests.get('{0}'.format(BAD_CLASS_URI_BASE_STRING),
+ auth=AUTH_STRING)
+ assert req.status_code == requests.codes.not_acceptable
+ assert INVALID_CLASS_MSG in req.text
+
+ req = requests.put('{0}'.format(BAD_CLASS_URI_BASE_STRING),
+ auth=AUTH_STRING, json=MOI_DATA_TMPL)
+ assert req.status_code == requests.codes.not_acceptable
+ assert INVALID_CLASS_MSG in req.text
+
+ req = requests.patch('{0}'.format(BAD_CLASS_URI_BASE_STRING),
+ auth=AUTH_STRING, json=MOI_DATA_PATCH)
+ assert req.status_code == requests.codes.not_acceptable
+ assert INVALID_CLASS_MSG in req.text
+
+ req = requests.delete('{0}'.format(BAD_CLASS_URI_BASE_STRING),
+ auth=AUTH_STRING)
+ assert req.status_code == requests.codes.not_acceptable
+ assert INVALID_CLASS_MSG in req.text