summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/frontend.py1
-rw-r--r--tests/test_ipalib/test_frontend.py16
2 files changed, 16 insertions, 1 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index db399ba5..6e79e539 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -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):
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index 44d8e54c..87296705 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -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.