aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-20 04:39:43 -0700
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-04-20 06:42:58 -0700
commit738954b053e173129b2c9a88e9cb758638785101 (patch)
tree4ffab6eb28299588f87a71e6ac85431e536e5076 /test/mocks
parente7aae53c5535a6187c4ad37f4efc4556368ad1bc (diff)
Leverage pytest parametrize mark in test_bad_moi_class test
Change-Id: I7218c5ca61669197d1e79189e841b0062524c02d 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/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