summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-09 04:35:06 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-09 04:35:06 +0000
commit72f3132d2b98a44881ae7001d0001602a66bf8b5 (patch)
treed75ce61572ba4d18fcc746583f911f150e1c968a /ipalib/tests/test_plugable.py
parent3495c67d57868a02bafe6f1935d4846cd5615bf5 (diff)
downloadfreeipa.git-72f3132d2b98a44881ae7001d0001602a66bf8b5.tar.gz
freeipa.git-72f3132d2b98a44881ae7001d0001602a66bf8b5.tar.xz
freeipa.git-72f3132d2b98a44881ae7001d0001602a66bf8b5.zip
95: Improved docstrings for ReadOnly class; added ReadOnly.__islocked__() method; added corresponding unit tests
Diffstat (limited to 'ipalib/tests/test_plugable.py')
-rw-r--r--ipalib/tests/test_plugable.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py
index 605debe5..42453ed5 100644
--- a/ipalib/tests/test_plugable.py
+++ b/ipalib/tests/test_plugable.py
@@ -62,6 +62,18 @@ class test_ReadOnly(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (object,)
assert callable(self.cls.__lock__)
+ assert callable(self.cls.__islocked__)
+
+ def test_lock(self):
+ """
+ Tests the `__lock__` and `__islocked__` methods.
+ """
+ o = self.cls()
+ assert o.__islocked__() is False
+ o.__lock__()
+ assert o.__islocked__() is True
+ raises(AssertionError, o.__lock__) # Can only be locked once
+ assert o.__islocked__() is True # This should still be True
def test_when_unlocked(self):
"""