From 72f3132d2b98a44881ae7001d0001602a66bf8b5 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sat, 9 Aug 2008 04:35:06 +0000 Subject: 95: Improved docstrings for ReadOnly class; added ReadOnly.__islocked__() method; added corresponding unit tests --- ipalib/tests/test_plugable.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ipalib/tests/test_plugable.py') 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): """ -- cgit