summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/tstutil.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-14 17:21:21 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-14 17:21:21 +0000
commitb403fd822b76a7deffe8110fbeb7993ef3cac3a5 (patch)
tree47cd3700b22c1e995484c35e68a5c140fd617886 /ipalib/tests/tstutil.py
parentca53615dddd487230c3e40231cb02467e19388d7 (diff)
downloadfreeipa.git-b403fd822b76a7deffe8110fbeb7993ef3cac3a5.tar.gz
freeipa.git-b403fd822b76a7deffe8110fbeb7993ef3cac3a5.tar.xz
freeipa.git-b403fd822b76a7deffe8110fbeb7993ef3cac3a5.zip
159: Added plugable.DictProxy class; added corresponding unit tests; added setitem(), delitem() functions to tstutil
Diffstat (limited to 'ipalib/tests/tstutil.py')
-rw-r--r--ipalib/tests/tstutil.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ipalib/tests/tstutil.py b/ipalib/tests/tstutil.py
index 7b3a2d5e..79e8ae38 100644
--- a/ipalib/tests/tstutil.py
+++ b/ipalib/tests/tstutil.py
@@ -60,6 +60,22 @@ def getitem(obj, key):
return obj[key]
+def setitem(obj, key, value):
+ """
+ Works like setattr but for dictionary interface. Uses this in combination
+ with raises() to test that, for example, TypeError is raised.
+ """
+ obj[key] = value
+
+
+def delitem(obj, key):
+ """
+ Works like delattr but for dictionary interface. Uses this in combination
+ with raises() to test that, for example, TypeError is raised.
+ """
+ del obj[key]
+
+
def no_set(obj, name, value='some_new_obj'):
"""
Tests that attribute cannot be set.