aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mocks/prov-mns-provider/src/tests/test_invalid_requests.py27
1 files changed, 8 insertions, 19 deletions
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 11632bdb6..b7bd40741 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
@@ -16,28 +16,17 @@ def test_unauthorized(req_method, url, req_params):
assert req.status_code == requests.codes.unauthorized
assert UNAUTHORIZED_MSG in req.text
-def test_bad_moi_class():
+@pytest.mark.parametrize(('req_method', 'req_params'), [
+ (getattr(requests, 'get'), {"auth": AUTH_STRING}),
+ (getattr(requests, 'put'), {"auth": AUTH_STRING, "json": MOI_DATA_TMPL}),
+ (getattr(requests, 'patch'), {"auth": AUTH_STRING, "json": MOI_DATA_PATCH}),
+ (getattr(requests, 'delete'), {"auth": AUTH_STRING})
+ ])
+def test_bad_moi_class(req_method, req_params):
'''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)
+ req = req_method(BAD_CLASS_URI_BASE_STRING, **req_params)
assert req.status_code == requests.codes.not_acceptable
assert INVALID_CLASS_MSG in req.text