mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add more ldap auth tests for ZD-2993
This commit is contained in:
parent
055a8d5d74
commit
91f50a4ce7
1 changed files with 17 additions and 1 deletions
|
@ -90,6 +90,22 @@ class LDAPAuthTestCase(TestCase):
|
|||
self.assertIn('saltusers', salt.auth.ldap.groups('saltuser', password='password'))
|
||||
|
||||
def test_auth_nopass(self):
|
||||
with patch.dict(salt.auth.ldap.__opts__, self.opts):
|
||||
opts = self.opts.copy()
|
||||
opts['auth.ldap.bindpw'] = 'p@ssw0rd!'
|
||||
with patch.dict(salt.auth.ldap.__opts__, opts):
|
||||
with patch('salt.auth.ldap._bind_for_search', return_value=Bind):
|
||||
assert salt.auth.ldap.auth('foo', None) == False
|
||||
|
||||
def test_auth_nouser(self):
|
||||
opts = self.opts.copy()
|
||||
opts['auth.ldap.bindpw'] = 'p@ssw0rd!'
|
||||
with patch.dict(salt.auth.ldap.__opts__, opts):
|
||||
with patch('salt.auth.ldap._bind_for_search', return_value=Bind):
|
||||
assert salt.auth.ldap.auth(None, 'foo') == False
|
||||
|
||||
def test_auth_nouserandpass(self):
|
||||
opts = self.opts.copy()
|
||||
opts['auth.ldap.bindpw'] = 'p@ssw0rd!'
|
||||
with patch.dict(salt.auth.ldap.__opts__, opts):
|
||||
with patch('salt.auth.ldap._bind_for_search', return_value=Bind):
|
||||
assert salt.auth.ldap.auth(None, None) == False
|
||||
|
|
Loading…
Add table
Reference in a new issue