1 | from base import TestCase |
---|
2 | from config import nt_properties, s_properties |
---|
3 | |
---|
4 | class TestPropertiesToolConf(TestCase): |
---|
5 | |
---|
6 | def afterSetUp(self): |
---|
7 | self.ptool = self.portal.portal_properties |
---|
8 | |
---|
9 | def testConfigurationNavtreePropertiesTool(self): |
---|
10 | # Configuration navtree_properties |
---|
11 | props = self.ptool.navtree_properties |
---|
12 | for prop_id, prop_type, prop_value in nt_properties: |
---|
13 | self.assertTrue(prop_id in props.propertyIds()) |
---|
14 | self.assertEqual(props.getPropertyType(prop_id), prop_type) |
---|
15 | p_value = list(props.getProperty(prop_id)) |
---|
16 | prop_value.sort() |
---|
17 | p_value.sort() |
---|
18 | self.assertEqual([v for v in prop_value if v in p_value], prop_value) |
---|
19 | |
---|
20 | def testConfigurationSitePropertiesTool(self): |
---|
21 | # Configuration site_properties |
---|
22 | props = self.ptool.site_properties |
---|
23 | for prop_id, prop_type, prop_value in s_properties: |
---|
24 | self.assertTrue(prop_id in props.propertyIds()) |
---|
25 | self.assertEqual(props.getPropertyType(prop_id), prop_type) |
---|
26 | p_value = list(props.getProperty(prop_id)) |
---|
27 | prop_value.sort() |
---|
28 | p_value.sort() |
---|
29 | self.assertEqual([v for v in prop_value if v in p_value], prop_value) |
---|
30 | |
---|
31 | def test_suite(): |
---|
32 | from unittest import TestSuite, makeSuite |
---|
33 | suite = TestSuite() |
---|
34 | suite.addTest(makeSuite(TestPropertiesToolConf)) |
---|
35 | return suite |
---|
36 | |
---|