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