source: main/waeup.sirp/trunk/src/waeup/sirp/tests/test_configuration.py @ 7022

Last change on this file since 7022 was 6921, checked in by Henrik Bettermann, 13 years ago

Verify also ISessionConfigurationAdd.

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
2## This program is free software; you can redistribute it and/or modify
3## it under the terms of the GNU General Public License as published by
4## the Free Software Foundation; either version 2 of the License, or
5## (at your option) any later version.
6##
7## This program is distributed in the hope that it will be useful,
8## but WITHOUT ANY WARRANTY; without even the implied warranty of
9## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10## GNU General Public License for more details.
11##
12## You should have received a copy of the GNU General Public License
13## along with this program; if not, write to the Free Software
14## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15##
16"""Tests for configuration containers and related.
17"""
18from zope.component.interfaces import IFactory
19from zope.interface import verify
20from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
21from waeup.sirp.configuration import (
22    ConfigurationContainer, SessionConfiguration, SessionConfigurationFactory)
23from waeup.sirp.interfaces import(
24    IConfigurationContainer, ISessionConfiguration, ISessionConfigurationAdd)
25
26class ConfigurationTest(FunctionalTestCase):
27
28    layer = FunctionalLayer
29
30    def setUp(self):
31        super(ConfigurationTest, self).setUp()
32        self.confcontainer = ConfigurationContainer()
33        self.sessionconf = SessionConfiguration()
34        return
35
36    def tearDown(self):
37        super(ConfigurationTest, self).tearDown()
38        return
39
40    def test_interfaces(self):
41        verify.verifyClass(IConfigurationContainer, ConfigurationContainer)
42        verify.verifyObject(IConfigurationContainer, self.confcontainer)
43        verify.verifyClass(ISessionConfiguration, SessionConfiguration)
44        verify.verifyObject(ISessionConfiguration, self.sessionconf)
45        verify.verifyClass(ISessionConfigurationAdd, SessionConfiguration)
46        verify.verifyObject(ISessionConfigurationAdd, self.sessionconf)
47
48class SessionConfigurationFactoryTest(FunctionalTestCase):
49
50    layer = FunctionalLayer
51
52    def setUp(self):
53        super(SessionConfigurationFactoryTest, self).setUp()
54        self.factory = SessionConfigurationFactory()
55
56    def tearDown(self):
57        super(SessionConfigurationFactoryTest, self).tearDown()
58
59    def test_interfaces(self):
60        verify.verifyClass(IFactory, SessionConfigurationFactory)
61        verify.verifyObject(IFactory, self.factory)
62
63    def test_factory(self):
64        obj = self.factory()
65        assert isinstance(obj, SessionConfiguration)
66
67    def test_getInterfaces(self):
68        implemented_by = self.factory.getInterfaces()
69        assert implemented_by.isOrExtends(ISessionConfiguration)
Note: See TracBrowser for help on using the repository browser.