mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Add empty token salt-api integration tests
This commit is contained in:
parent
4da2e0757b
commit
9756f8f56e
@ -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…
Reference in New Issue
Block a user