summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/tstutil.py
diff options
context:
space:
mode:
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 7b3a2d5ea..79e8ae383 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.