Changeset 3547 in products for quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/testInstallation.py
- Timestamp:
- Sep 11, 2012 7:30:25 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/testInstallation.py
r3140 r3547 17 17 PROPERTY_SHEET = 'seo_properties' 18 18 STOP_WORDS = ['a', 'an', 'amp', 'and', 'are', 'arial', 'as', 'at', 'be', 'but', 19 'by', 'can', 'com', 'do', 'font', 'for', 'from', 'gif', 'had', 'has',20 'have', 'he', 'helvetica', 'her', 'his', 'how', 'href', 'i', 'if', 'in',21 'is', 'it', 'javascript', 'jpg', 'made', 'net', 'of', 'on', 'or', 'org',22 'our', 'sans', 'see', 'serif', 'she', 'that', 'the', 'this', 'to', 'us',23 'we', 'with', 'you', 'your']19 'by', 'can', 'com', 'do', 'font', 'for', 'from', 'gif', 'had', 20 'has', 'have', 'he', 'helvetica', 'her', 'his', 'how', 'href', 21 'i', 'if', 'in', 'is', 'it', 'javascript', 'jpg', 'made', 'net', 22 'of', 'on', 'or', 'org', 'our', 'sans', 'see', 'serif', 'she', 23 'that', 'the', 'this', 'to', 'us', 'we', 'with', 'you', 'your'] 24 24 25 25 PROPS = {'stop_words': STOP_WORDS, … … 70 70 map_sheet = self.properties[PROPERTY_SHEET] 71 71 for key, value in PROPS.items(): 72 self.failUnless(map_sheet.hasProperty(key) and \72 self.failUnless(map_sheet.hasProperty(key) and 73 73 list(map_sheet.getProperty(key)) == value) 74 74 75 75 def test_configlet_install(self): 76 76 configTool = getToolByName(self.portal, 'portal_controlpanel', None) 77 self.assert_(PROJECT_NAME in [a.getId() for a in \78 configTool.listActions()], \77 self.assert_(PROJECT_NAME in [a.getId() for a in 78 configTool.listActions()], 79 79 'Configlet not found') 80 80 … … 89 89 view = queryMultiAdapter((self.portal, request), name="plone") 90 90 manager = queryMultiAdapter((self.portal['front-page'], request, view), 91 91 IViewletManager, name='plone.htmlhead') 92 92 for p in VIEWLETS: 93 self.assert_(manager.get(p) is not None, "Not registered '%s' " \93 self.assert_(manager.get(p) is not None, "Not registered '%s' " 94 94 "viewlet" % p) 95 95 … … 122 122 def test_configlet_uninstall(self): 123 123 self.assertNotEqual(self.qi.isProductInstalled(PROJECT_NAME), True, 124 'qSEOptimizer is already installed')124 'qSEOptimizer is already installed') 125 125 126 126 configTool = getToolByName(self.portal, 'portal_controlpanel', None) 127 self.assertEqual(PROJECT_NAME in [a.getId() for a in \127 self.assertEqual(PROJECT_NAME in [a.getId() for a in 128 128 configTool.listActions()], False, 129 129 'Configlet found after uninstallation') … … 138 138 for p in VIEWLETS: 139 139 self.assertEqual(manager.get(p) is None, True, 140 "'%s' viewlet present after uninstallation" % p)140 "'%s' viewlet present after uninstallation" % p) 141 141 142 142 def test_browserlayer_uninstall(self): … … 146 146 from plone.browserlayer import utils 147 147 self.assertEqual(IPloneSEOLayer in utils.registered_layers(), False, 148 "Still registered 'IPloneSEOLayer' browser layer")148 "Still registered 'IPloneSEOLayer' browser layer") 149 149 150 150 def test_action_uninstall(self): … … 152 152 action_ids = [a.id for a in atool.listActions()] 153 153 self.assertEqual("SEOProperties" in action_ids, False, 154 "'SEOProperties' action not removed from " \154 "'SEOProperties' action not removed from " 155 155 "portal_actions on uninstallation") 156 156 … … 178 178 for type in SEO_CONTENT: 179 179 self.assertEqual(self.types_tool.getTypeInfo(type).i18n_domain, 180 'plone', "Not changed of %s content type's " \180 'plone', "Not changed of %s content type's " 181 181 "domain to 'plone'" % type) 182 182 … … 191 191 mto.sort() 192 192 self.assertEqual(mto, expect_mto, 193 "Not changed format metatags order list from \"" \194 "metaname accessor\" to \"metaname\". %s != %s" \193 "Not changed format metatags order list from \"" 194 "metaname accessor\" to \"metaname\". %s != %s" 195 195 % (mto, expect_mto)) 196 196 … … 202 202 mto.sort() 203 203 self.assertEqual(mto, DEFAULT_METATAGS_ORDER, 204 "Not added metatags order list with default values." \204 "Not added metatags order list with default values." 205 205 "%s != %s" % (mto, DEFAULT_METATAGS_ORDER)) 206 206 … … 213 213 for type in CONTENTTYPES_WITH_SEOACTION: 214 214 self.types_tool.getTypeInfo(type).addAction( 215 216 217 218 219 220 221 215 id='seo_properties', 216 name='SEO Properties', 217 action=None, 218 condition=None, 219 permission=(u'Modify portal content',), 220 category='object', 221 ) 222 222 # Check presence seoaction in content type 223 seoaction = [act.id for act in \224 self.types_tool.getTypeInfo(type).listActions() \223 seoaction = [act.id for act in 224 self.types_tool.getTypeInfo(type).listActions() 225 225 if act.id == 'seo_properties'] 226 226 self.assertEqual(bool(seoaction), True, 227 "Not added seoaction to content type %s for " \227 "Not added seoaction to content type %s for " 228 228 "testing" % type) 229 229 … … 232 232 # Check presence seoaction in content type 233 233 for type in CONTENTTYPES_WITH_SEOACTION: 234 seoaction = [act.id for act in \235 self.types_tool.getTypeInfo(type).listActions() \234 seoaction = [act.id for act in 235 self.types_tool.getTypeInfo(type).listActions() 236 236 if act.id == 'seo_properties'] 237 237 self.assertEqual(bool(seoaction), False, 238 "Not removed seoaction in content type %s" % type)238 "Not removed seoaction in content type %s" % type) 239 239 240 240 # Check added content type names in seo properties tool … … 243 243 ctws.sort() 244 244 self.assertEqual(ctws, CONTENTTYPES_WITH_SEOACTION, 245 "Not added content type names in seo properties " \246 "tool if content types have seoaction. %s != %s" \245 "Not added content type names in seo properties " 246 "tool if content types have seoaction. %s != %s" 247 247 % (ctws, CONTENTTYPES_WITH_SEOACTION)) 248 248 … … 259 259 path = map(string.strip, string.split(path, ',')) 260 260 self.assertEqual(layer in path, False, 261 '%s layer found in %s after uninstallation' \261 '%s layer found in %s after uninstallation' 262 262 % (layer, skin)) 263 263 … … 274 274 value = doc.getProperty(PROPERTY_LINK) 275 275 has_prop = bool(doc.hasProperty('qSEO_canonical')) 276 self.assertEqual(has_prop, False, "Property 'qSEO_canonical' is " \276 self.assertEqual(has_prop, False, "Property 'qSEO_canonical' is " 277 277 "not deleted.") 278 self.assertEqual(value == 'val', True, "Property not migrated from " \278 self.assertEqual(value == 'val', True, "Property not migrated from " 279 279 "'qSEO_canonical' to '%s'." % PROPERTY_LINK) 280 280
Note: See TracChangeset
for help on using the changeset viewer.