def test_edit_summary_escaping(self): data = self.get_dict() data['summary'] = '<b>oh my</b>' r = self.client.post(self.basic_edit_url, data) eq_(r.status_code, 200) # Fetch the page so the LinkifiedTranslation gets in cache. r = self.client.get(reverse('devhub.addons.edit', args=[data['slug']])) eq_(pq(r.content)('[data-name=summary]').html().strip(), '<span lang="en-us"><b>oh my</b></span>') # Now make sure we don't have escaped content in the rendered form. form = AddonFormBasic(instance=self.get_addon(), request=object()) eq_(pq('<body>%s</body>' % form['summary'])('[lang="en-us"]').html().strip(), '<b>oh my</b>')
def test_edit_summary_escaping(self): data = self.get_dict(summary='<b>oh my</b>') r = self.client.post(self.edit_url, data) eq_(r.status_code, 200) # Fetch the page so the LinkifiedTranslation gets in cache. webapp = self.get_webapp() r = self.client.get(webapp.get_dev_url('edit')) eq_( pq(r.content)('[data-name=summary]').html().strip(), '<span lang="en-us"><b>oh my</b></span>') # Now make sure we don't have escaped content in the rendered form. form = AddonFormBasic(instance=webapp, request=object()) eq_( pq('<body>%s</body>' % form['summary'])('[lang="en-us"]').html(), data['summary'])