Add empty token salt-api integration tests

This commit is contained in:
Ch3LL 2018-08-24 16:14:52 -04:00
parent 652dbf63f4
commit d45f6c7866
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73

View file

@ -124,6 +124,45 @@ class TestRun(cptc.BaseRestCherryPyTest):
})
self.assertEqual(response.status, '401 Unauthorized')
def test_run_empty_token(self):
'''
Test the run URL with empty token
'''
cmd = dict(self.low, **{'token': ''})
body = urlencode(cmd)
request, response = self.request('/run', method='POST', body=body,
headers={
'content-type': 'application/x-www-form-urlencoded'
})
assert response.status == '401 Unauthorized'
def test_run_empty_token_upercase(self):
'''
Test the run URL with empty token with upercase characters
'''
cmd = dict(self.low, **{'ToKen': ''})
body = urlencode(cmd)
request, response = self.request('/run', method='POST', body=body,
headers={
'content-type': 'application/x-www-form-urlencoded'
})
assert response.status == '401 Unauthorized'
def test_run_wrong_token(self):
'''
Test the run URL with incorrect token
'''
cmd = dict(self.low, **{'token': 'bad'})
body = urlencode(cmd)
request, response = self.request('/run', method='POST', body=body,
headers={
'content-type': 'application/x-www-form-urlencoded'
})
assert response.status == '401 Unauthorized'
class TestWebhookDisableAuth(cptc.BaseRestCherryPyTest):