mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-20 11:48:43 -06:00
Added unit test for Param.ispassword() method
This commit is contained in:
parent
4afee15d4b
commit
500b816681
@ -265,7 +265,6 @@ class Param(plugable.ReadOnly):
|
||||
"""
|
||||
Return ``True`` is this Param is a password.
|
||||
"""
|
||||
# FIXME: add unit test
|
||||
return 'password' in self.flags
|
||||
|
||||
def __clone__(self, **override):
|
||||
|
@ -226,6 +226,22 @@ class test_Param(ClassChecker):
|
||||
assert str(e) == \
|
||||
'Param.__init__() takes no such kwargs: another, whatever'
|
||||
|
||||
def test_ispassword(self):
|
||||
"""
|
||||
Test the `ipalib.frontend.Param.ispassword` method.
|
||||
"""
|
||||
name = 'userpassword'
|
||||
okay = 'password'
|
||||
nope = ['', 'pass', 'word', 'passwd']
|
||||
for flag in nope:
|
||||
o = self.cls(name, flags=[flag])
|
||||
assert o.ispassword() is False
|
||||
o = self.cls(name, flags=[flag, okay])
|
||||
assert o.ispassword() is True
|
||||
assert self.cls(name).ispassword() is False
|
||||
assert self.cls(name, flags=[okay]).ispassword() is True
|
||||
assert self.cls(name, flags=[okay]+nope).ispassword() is True
|
||||
|
||||
def test_clone(self):
|
||||
"""
|
||||
Test the `ipalib.frontend.Param.__clone__` method.
|
||||
|
Loading…
Reference in New Issue
Block a user