[1] | 1 | |
---|
| 2 | """ This module contains class that tests product's installation procedure """ |
---|
| 3 | |
---|
| 4 | import os, sys, string |
---|
| 5 | if __name__ == '__main__': |
---|
| 6 | execfile(os.path.join(sys.path[0], 'framework.py')) |
---|
| 7 | |
---|
| 8 | from commonTestingStuff import * |
---|
| 9 | |
---|
| 10 | class TestInstallation(PloneTestCase.PloneTestCase): |
---|
| 11 | """ Class for testing installation procedure """ |
---|
| 12 | |
---|
| 13 | def afterSetUp(self): |
---|
| 14 | """ AfterSetUp features """ |
---|
| 15 | self.qi = getToolByName(self.portal, 'portal_quickinstaller') |
---|
| 16 | self.qi.installProduct(PRODUCT) |
---|
| 17 | |
---|
| 18 | def testLayerInstalling(self): |
---|
| 19 | """ Test skins layer installation """ |
---|
| 20 | skinstool=getToolByName(self.portal, 'portal_skins') |
---|
| 21 | for skin in skinstool.getSkinSelections(): |
---|
| 22 | path = skinstool.getSkinPath(skin) |
---|
| 23 | path = map(string.strip, string.split(path, ',')) |
---|
| 24 | self.failUnless(PRODUCT in path, 'geolocation layer not found in %s' % skin) |
---|
| 25 | |
---|
| 26 | def testLayerRemoving(self): |
---|
| 27 | """ Test skins layer uninstallation """ |
---|
| 28 | self.qi.uninstallProducts([PRODUCT,]) |
---|
| 29 | self.assertEqual(self.qi.isProductInstalled(PRODUCT), False,'geolocation is installed yet') |
---|
| 30 | skinstool=getToolByName(self.portal, 'portal_skins') |
---|
| 31 | for skin in skinstool.getSkinSelections(): |
---|
| 32 | path = skinstool.getSkinPath(skin) |
---|
| 33 | path = map(string.strip, string.split(path, ',')) |
---|
| 34 | self.failIf(PRODUCT in path, 'geolocation layer found in %s after uninstallation' % skin) |
---|
| 35 | |
---|
| 36 | def testAddingGeoLocationAction(self): |
---|
| 37 | """ Test adding GEOLocation action to portal_types """ |
---|
| 38 | ptypes = getToolByName(self.portal, 'portal_types') |
---|
| 39 | for tname in PORTAL_TYPES: |
---|
| 40 | tp = ptypes.getTypeInfo(tname) |
---|
| 41 | self.failUnless('edit_location' in [a.id for a in tp.listActions()], |
---|
| 42 | "%s portal type haven't 'edit_location' action" % tname) |
---|
| 43 | |
---|
| 44 | def testRemovingGeoLocationAction(self): |
---|
| 45 | """ Test removing GEOLocation action from portal_types """ |
---|
| 46 | self.qi.uninstallProducts([PRODUCT,]) |
---|
| 47 | self.assertEqual(self.qi.isProductInstalled(PRODUCT), False,'geolocation is installed yet') |
---|
| 48 | ptypes = getToolByName(self.portal, 'portal_types') |
---|
| 49 | for tname in PORTAL_TYPES: |
---|
| 50 | tp = ptypes.getTypeInfo(tname) |
---|
| 51 | self.failIf('edit_location' in [a.id for a in tp.listActions()], |
---|
| 52 | "%s portal type have 'edit_location' action" % tname) |
---|
| 53 | |
---|
| 54 | def testAddingCatalogIndex(self): |
---|
| 55 | """ Test adding index to portal_catalog tool """ |
---|
| 56 | portal_catalog = getToolByName(self.portal, 'portal_catalog') |
---|
| 57 | self.failUnless(GEO_INDEX in portal_catalog.indexes(), 'Index not found in portal_catalog') |
---|
| 58 | |
---|
| 59 | def testAddingCatalogColumn(self): |
---|
| 60 | """ Test adding column to portal_catalog tool """ |
---|
| 61 | portal_catalog = getToolByName(self.portal, 'portal_catalog') |
---|
| 62 | self.failUnless(GEO_INDEX in portal_catalog.schema(), 'Column not found in portal_catalog') |
---|
| 63 | |
---|
| 64 | def test_suite(): |
---|
| 65 | from unittest import TestSuite, makeSuite |
---|
| 66 | suite = TestSuite() |
---|
| 67 | suite.addTest(makeSuite(TestInstallation)) |
---|
| 68 | return suite |
---|
| 69 | |
---|
| 70 | if __name__ == '__main__': |
---|
| 71 | framework() |
---|