1 from common import * # pylint: disable=W0614
3 def test_unauthorized():
4 '''Check service denies access if
5 invalid credentials provided'''
7 req = requests.get('{0}'.format(URI_GET_STRING), auth=INVALID_AUTH_STRING)
8 assert req.status_code == requests.codes.unauthorized
9 assert UNAUTHORIZED_MSG in req.text
11 req = requests.put('{0}'.format(URI_PUT_STRING), auth=INVALID_AUTH_STRING,
13 assert req.status_code == requests.codes.unauthorized
14 assert UNAUTHORIZED_MSG in req.text
16 req = requests.patch('{0}'.format(URI_PATCH_STRING),
17 auth=INVALID_AUTH_STRING, json=MOI_DATA_PATCH)
18 assert req.status_code == requests.codes.unauthorized
19 assert UNAUTHORIZED_MSG in req.text
21 req = requests.delete('{0}'.format(URI_DELETE_STRING),
22 auth=INVALID_AUTH_STRING)
23 assert req.status_code == requests.codes.unauthorized
24 assert UNAUTHORIZED_MSG in req.text