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.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ipalib/tests/tstutil.py b/ipalib/tests/tstutil.py
index 37b7745f..12ca119d 100644
--- a/ipalib/tests/tstutil.py
+++ b/ipalib/tests/tstutil.py
@@ -49,6 +49,14 @@ def raises(exception, callback, *args, **kw):
raise ExceptionNotRaised(exception)
+def getitem(obj, key):
+ """
+ Works like getattr but for dictionary interface. Uses this in combination
+ with raises() to test that, for example, KeyError is raised.
+ """
+ return obj[key]
+
+
def no_set(obj, name, value='some_new_obj'):
"""
Tests that attribute cannot be set.