diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-12-18 02:08:41 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-12-18 02:08:41 -0700 |
commit | 4d1681176afc45c57fb4316892f939bda1bacf1d (patch) | |
tree | 04abc4122c0dc3ab1d8de54858b94f72af0e5f71 /tests | |
parent | cb2f294cfef9b47e03b82c85cf1db7e7bc3574ef (diff) | |
download | freeipa-4d1681176afc45c57fb4316892f939bda1bacf1d.tar.gz freeipa-4d1681176afc45c57fb4316892f939bda1bacf1d.tar.xz freeipa-4d1681176afc45c57fb4316892f939bda1bacf1d.zip |
New Param: added unit tests for TypeError cases in DefaultFrom.__init__()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_ipalib/test_parameter.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_parameter.py b/tests/test_ipalib/test_parameter.py index 4fc9a0e78..d7f8e45c3 100644 --- a/tests/test_ipalib/test_parameter.py +++ b/tests/test_ipalib/test_parameter.py @@ -48,6 +48,14 @@ class test_DefaultFrom(ClassChecker): o = self.cls(lam) assert read_only(o, 'keys') == ('first', 'last') + # Test that TypeError is raised when callback isn't callable: + e = raises(TypeError, self.cls, 'whatever') + assert str(e) == CALLABLE_ERROR % ('callback', 'whatever', str) + + # Test that TypeError is raised when a key isn't an str: + e = raises(TypeError, self.cls, callback, 'givenname', 17) + assert str(e) == TYPE_ERROR % ('keys', str, 17, int) + def test_call(self): """ Test the `ipalib.parameter.DefaultFrom.__call__` method. |