Changeset 3125 in products


Ignore:
Timestamp:
Apr 15, 2011 3:25:07 PM (13 years ago)
Author:
zidane
Message:

added tests replace escape characters in title and comment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/tests/testBugs.py

    r3012 r3125  
    102102        except IOError: 
    103103            self.fail("overrides.zcml removed from the package root") 
     104 
     105    def test_escape_characters_title(self): 
     106        """Change escape characters in title of SEO properties  
     107           Bug url http://plone.org/products/plone-seo/issues/31  
     108        """        
     109        from cgi import escape 
     110        title = 'New <i>Title</i>' 
     111        form_data = {'seo_title': title, 
     112                     'seo_title_override:int': 1, 
     113                     'form.button.Save': "Save", 
     114                     'form.submitted:int': 1} 
     115             
     116        res = self.publish(path=self.mydoc_path+'/@@seo-context-properties', 
     117                     basic=self.basic_auth, request_method='POST', 
     118                     stdin=StringIO(urllib.urlencode(form_data))) 
     119        html = self.publish(self.mydoc_path, self.basic_auth).getBody() 
     120        m = re.match('.*<title>\\s*%s\\s*</title>' % escape(title), html, re.S|re.M) 
     121        self.assert_(m, 'Title is not escaped properly.')        
     122 
     123    def test_escape_characters_comment(self): 
     124        """Change escape characters in comment of SEO properties  
     125        """        
     126        from cgi import escape 
     127        comment = 'New <i>comment</i>' 
     128        form_data = {'seo_title': 'New Title', 
     129                     'seo_title_override:int': 1, 
     130                     'seo_html_comment': comment, 
     131                     'seo_html_comment_override:int': 1, 
     132                     'form.button.Save': "Save", 
     133                     'form.submitted:int': 1} 
     134             
     135        res = self.publish(path=self.mydoc_path+'/@@seo-context-properties', 
     136                     basic=self.basic_auth, request_method='POST', 
     137                     stdin=StringIO(urllib.urlencode(form_data))) 
     138        html = self.publish(self.mydoc_path, self.basic_auth).getBody() 
     139        m = re.match('.*<!--\\s*%s\\s*-->' % escape(comment), html, re.S|re.M) 
     140        self.assert_(m, 'Comment is not escaped properly.')        
    104141 
    105142    def test_bug_custom_metatags_update(self): 
Note: See TracChangeset for help on using the changeset viewer.