Add empty token salt-api integration tests

This commit is contained in:
Ch3LL 2018-09-21 16:41:53 -04:00
parent 4da2e0757b
commit 9756f8f56e
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):