mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add empty token salt-api integration tests
This commit is contained in:
parent
652dbf63f4
commit
d45f6c7866
1 changed files with 39 additions and 0 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue