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