| 1 | import unittest |
|---|
| 2 | from Products.CMFCore.utils import getToolByName |
|---|
| 3 | |
|---|
| 4 | from quintagroup.ploneformgen.readonlystringfield.tests.base import \ |
|---|
| 5 | ReadOnlyStringFieldTestCase |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | class TestSetup(ReadOnlyStringFieldTestCase): |
|---|
| 9 | |
|---|
| 10 | def afterSetUp(self): |
|---|
| 11 | self.loginAsPortalOwner() |
|---|
| 12 | |
|---|
| 13 | def test_installerTool(self): |
|---|
| 14 | tool = getToolByName(self.portal, 'portal_quickinstaller') |
|---|
| 15 | self.failUnless(tool.isProductInstalled('PloneFormGen'), |
|---|
| 16 | 'PloneFormGen product is not installed.') |
|---|
| 17 | |
|---|
| 18 | def test_factoryTool(self): |
|---|
| 19 | tool = getToolByName(self.portal, 'portal_factory') |
|---|
| 20 | self.failUnless('FormReadonlyStringField' in tool._factory_types.keys(), |
|---|
| 21 | 'FormReadonlyStringField type is not in portal_factory tool.') |
|---|
| 22 | |
|---|
| 23 | def test_typesTool(self): |
|---|
| 24 | tool = getToolByName(self.portal, 'portal_types') |
|---|
| 25 | self.failUnless('FormReadonlyStringField' in tool.objectIds(), |
|---|
| 26 | 'FormReadonlyStringField type is not in portal_types tool.') |
|---|
| 27 | |
|---|
| 28 | def test_propertiesTool(self): |
|---|
| 29 | tool = getToolByName(self.portal, 'portal_properties') |
|---|
| 30 | navtree = tool.navtree_properties |
|---|
| 31 | self.failUnless('FormReadonlyStringField' in navtree.metaTypesNotToList, |
|---|
| 32 | 'FormReadonlyStringField is not in metaTypesNotToList property.') |
|---|
| 33 | site = tool.site_properties |
|---|
| 34 | self.failUnless('FormReadonlyStringField' in site.types_not_searched, |
|---|
| 35 | 'FormReadonlyStringField is not in types_not_searched property.') |
|---|
| 36 | |
|---|
| 37 | def test_skinsTool(self): |
|---|
| 38 | tool = getToolByName(self.portal, 'portal_skins') |
|---|
| 39 | self.failUnless('readonlystringfield' in tool.objectIds(), |
|---|
| 40 | 'There is no readonlystringfield folder in portal_skins.') |
|---|
| 41 | for path_id, path in tool._getSelections().items(): |
|---|
| 42 | layers = [l.strip() for l in path.split(',')] |
|---|
| 43 | self.failUnless('readonlystringfield' in layers, |
|---|
| 44 | 'readonlystringfield layer is not registered for %s.' % path_id) |
|---|
| 45 | |
|---|
| 46 | def test_suite(): |
|---|
| 47 | suite = unittest.TestSuite() |
|---|
| 48 | suite.addTest(unittest.makeSuite(TestSetup)) |
|---|
| 49 | return suite |
|---|