summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-01 03:12:17 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-01 03:12:17 +0000
commit31fc955355ac8d873b82d129021f599f820c2694 (patch)
tree85e686aefaffeddd6307e4e0eeff4447c85727e3 /ipalib/tests/test_plugable.py
parentf53dec2600f95246a72fa3c847a485d2a94edfa7 (diff)
downloadfreeipa.git-31fc955355ac8d873b82d129021f599f820c2694.tar.gz
freeipa.git-31fc955355ac8d873b82d129021f599f820c2694.tar.xz
freeipa.git-31fc955355ac8d873b82d129021f599f820c2694.zip
34: Added tests.unit_common with frequently used utility functions; split ro __setattr__, __delattr__ methods out of Proxy and into new ReadOnly base class; added corresponding unit tests
Diffstat (limited to 'ipalib/tests/test_plugable.py')
-rw-r--r--ipalib/tests/test_plugable.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py
index 023bf45f..e69060b3 100644
--- a/ipalib/tests/test_plugable.py
+++ b/ipalib/tests/test_plugable.py
@@ -21,6 +21,7 @@
Unit tests for `ipalib.plugable` module.
"""
+import unit_common as uc
from ipalib import plugable, errors
@@ -52,6 +53,23 @@ def test_Plugin():
assert repr(p) == '%s.some_plugin()' % __name__
+def test_ReadOnly():
+ obj = plugable.ReadOnly()
+ names = ['not_an_attribute', 'an_attribute']
+ for name in names:
+ uc.no_set(obj, name)
+ uc.no_del(obj, name)
+
+ class some_ro_class(plugable.ReadOnly):
+ def __init__(self):
+ object.__setattr__(self, 'an_attribute', 'Hello world!')
+ obj = some_ro_class()
+ for name in names:
+ uc.no_set(obj, name)
+ uc.no_del(obj, name)
+ assert uc.read_only(obj, 'an_attribute') == 'Hello world!'
+
+
def test_Proxy():
class CommandProxy(plugable.Proxy):
__slots__ = (