aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/prov-mns-provider/src
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-16 04:04:12 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-16 11:36:42 +0000
commite7c68f9279c82436855c1dfcbfe8195ba434e950 (patch)
tree0746d794bb2cb577c671b719605c748c15100b87 /test/mocks/prov-mns-provider/src
parentbabc5a81adcab1090b7041499321a3920e297736 (diff)
Add test to verify bad MOI handling by the service
Functional test for verifying that the service handles bad MOI class in URI string properly and returns appropriate response to the client. Change-Id: I606aaba5c400f81e8142a34f250bc249251feaf7 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'test/mocks/prov-mns-provider/src')
-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