diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-14 17:29:13 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-14 17:29:13 +0000 |
commit | 87cad5078a3c9ef7a978c85905309ee7d3ec194d (patch) | |
tree | 5eff8a62f6290093786212747b2756d12cc832bc /ipalib | |
parent | b403fd822b76a7deffe8110fbeb7993ef3cac3a5 (diff) | |
download | freeipa-87cad5078a3c9ef7a978c85905309ee7d3ec194d.tar.gz freeipa-87cad5078a3c9ef7a978c85905309ee7d3ec194d.tar.xz freeipa-87cad5078a3c9ef7a978c85905309ee7d3ec194d.zip |
160: DictProxy now checks type of d in __init__(); updated unit tests
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugable.py | 1 | ||||
-rw-r--r-- | ipalib/tests/test_plugable.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 66cb18fe5..ffef8d643 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -484,6 +484,7 @@ class DictProxy(ReadOnly): """ :param d: The ``dict`` instance to proxy. """ + assert type(d) is dict, '`d` must be %r, got %r' % (dict, type(d)) self.__d = d self.__lock__() assert self.__islocked__() diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index 5c907dc7a..2854ee6a6 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -461,6 +461,8 @@ class test_DictProxy(ClassChecker): def test_class(self): assert self.cls.__bases__ == (plugable.ReadOnly,) + for non_dict in ('hello', 69, object): + raises(AssertionError, self.cls, non_dict) def test_DictProxy(self): cnt = 10 |