From f3762a76c0824296e90385eac27455aaf06af32d Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 1 Aug 2008 20:42:35 +0000 Subject: 40: Rewrote dictionary interface for plugable.NameSpace to better suite new architecture --- ipalib/tests/tstutil.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ipalib/tests/tstutil.py') 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. -- cgit