summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-04 03:34:16 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-04 03:34:16 +0000
commite1f8619d4adbc15415e2959496640c0f707c54fe (patch)
treec8a982d0d3e173b7fdcdef1af006ba6a8150f08c /ipalib/tests/test_public.py
parenta5c6bf179bed52602222b76cf2dcd09f7d461dea (diff)
downloadfreeipa.git-e1f8619d4adbc15415e2959496640c0f707c54fe.tar.gz
freeipa.git-e1f8619d4adbc15415e2959496640c0f707c54fe.tar.xz
freeipa.git-e1f8619d4adbc15415e2959496640c0f707c54fe.zip
254: Added public.Application base class; added corresponding unit tests
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index ac1ae818..52fb9336 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -690,3 +690,36 @@ class test_Property(ClassChecker):
assert isinstance(opt, public.Option)
assert opt.name == 'givenname'
assert opt.doc == 'User first name'
+
+
+class test_Application(ClassChecker):
+ """
+ Tests the `public.Application` class.
+ """
+ _cls = public.Application
+
+ def test_class(self):
+ assert self.cls.__bases__ == (public.Command,)
+ assert type(self.cls.application) is property
+
+ def test_application(self):
+ """
+ Tests the `public.Application.application` property.
+ """
+ assert 'application' in self.cls.__public__ # Public
+ app = 'The external application'
+ class example(self.cls):
+ 'A subclass'
+ for o in (self.cls(), example()):
+ assert o.application is None
+ e = raises(TypeError, setattr, o, 'application', None)
+ assert str(e) == (
+ '%s.application cannot be None' % o.__class__.__name__
+ )
+ o.application = app
+ assert o.application is app
+ e = raises(AttributeError, setattr, o, 'application', app)
+ assert str(e) == (
+ '%s.application can only be set once' % o.__class__.__name__
+ )
+ assert o.application is app