Changeset 3152 in products for quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testPinging.py
- Timestamp:
- Apr 20, 2011 8:20:36 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testPinging.py
r2538 r3152 7 7 def afterSetUp(self): 8 8 super(TestPinging, self).afterSetUp() 9 self.workflow.setChainForPortalTypes(pt_names=('News Item','Document'), 10 chain="simple_publication_workflow") 11 self.gsm_props = self.portal.portal_properties['googlesitemap_properties'] 9 self.workflow.setChainForPortalTypes( 10 pt_names=('News Item', 'Document'), 11 chain="simple_publication_workflow") 12 gsm_properties = 'googlesitemap_properties' 13 self.gsm_props = self.portal.portal_properties[gsm_properties] 12 14 # Add sitemaps 13 self.contentSM = _createObjectByType('Sitemap', self.portal, id='google-sitemaps') 14 self.contentSM.setPingTransitions(('simple_publication_workflow#publish',)) 15 self.newsSM = _createObjectByType('Sitemap', self.portal, id='news-sitemaps') 16 self.newsSM.setPortalTypes(('News Item','Document')) 17 self.newsSM.setPingTransitions(('simple_publication_workflow#publish',)) 18 self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps' 15 self.contentSM = _createObjectByType('Sitemap', self.portal, 16 id='google-sitemaps') 17 spw_publish = 'simple_publication_workflow#publish' 18 self.contentSM.setPingTransitions((spw_publish,)) 19 self.newsSM = _createObjectByType('Sitemap', self.portal, 20 id='news-sitemaps') 21 self.newsSM.setPortalTypes(('News Item', 'Document')) 22 self.newsSM.setPingTransitions((spw_publish,)) 23 self.sitemapUrl = '/' + self.portal.absolute_url(1) + \ 24 '/google-sitemaps' 19 25 # Add testing document to portal 20 26 self.my_doc = _createObjectByType('Document', self.portal, id='my_doc') 21 self.my_news = _createObjectByType('News Item', self.portal, id='my_news') 27 self.my_news = _createObjectByType('News Item', self.portal, 28 id='my_news') 22 29 23 30 def testAutomatePinging(self): … … 32 39 sys.stdout = back_out 33 40 34 self.assert_('Pinged %s sitemap to Google' % self.contentSM.absolute_url() in data, 41 self.assert_('Pinged %s sitemap to Google' \ 42 % self.contentSM.absolute_url() in data, 35 43 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 36 self.assert_('Pinged %s sitemap to Google' % self.newsSM.absolute_url() in data, 44 self.assert_('Pinged %s sitemap to Google' \ 45 % self.newsSM.absolute_url() in data, 37 46 "Not pinged %s: '%s'" % (self.newsSM.id, data)) 38 47 … … 47 56 sys.stdout = back_out 48 57 49 self.assert_('Pinged %s sitemap to Google' % self.newsSM.absolute_url() in data, 58 self.assert_('Pinged %s sitemap to Google' \ 59 % self.newsSM.absolute_url() in data, 50 60 "Not pinged %s: '%s'" % (self.newsSM.id, data)) 51 self.assert_(not 'Pinged %s sitemap to Google' % self.contentSM.absolute_url() in data, 61 self.assert_(not 'Pinged %s sitemap to Google' \ 62 % self.contentSM.absolute_url() in data, 52 63 "Pinged %s on news: '%s'" % (self.contentSM.id, data)) 53 64 54 65 def testPingingWithSetupForm(self): 55 66 # Ping news and content sitemaps 56 formUrl = '/' +self.portal.absolute_url(1) + '/prefs_gsm_settings'57 qs = 'smselected:list=%s&smselected:list=%s&form.button.Ping=1 &form.submitted=1' %\58 (self.contentSM.id, self.newsSM.id)67 formUrl = '/' + self.portal.absolute_url(1) + '/prefs_gsm_settings' 68 qs = 'smselected:list=%s&smselected:list=%s&form.button.Ping=1' \ 69 '&form.submitted=1' % (self.contentSM.id, self.newsSM.id) 59 70 60 71 back_out, myout = sys.stdout, StringIO() … … 67 78 sys.stdout = back_out 68 79 69 self.assert_('Pinged %s sitemap to Google' % self.contentSM.absolute_url() in data, 80 self.assert_('Pinged %s sitemap to Google' \ 81 % self.contentSM.absolute_url() in data, 70 82 "Not pinged %s: '%s'" % (self.contentSM.id, data)) 71 self.assert_('Pinged %s sitemap to Google' % self.newsSM.absolute_url() in data, 83 self.assert_('Pinged %s sitemap to Google' \ 84 % self.newsSM.absolute_url() in data, 72 85 "Not pinged %s: '%s'" % (self.newsSM.id, data)) 73 74 86 75 87
Note: See TracChangeset
for help on using the changeset viewer.