def test_canonical_url(self):
     self.portal.invokeFactory('Document', 'doc-1')
     doc = self.portal['doc-1']
     behavior = ICanonicalURL(doc)
     self.assertEqual(behavior.canonical_url, None)
     behavior.canonical_url = u'http://www.simplesconsultoria.com.br/'
     self.assertEqual(behavior.canonical_url, u'http://www.simplesconsultoria.com.br/')
 def test_viewlet(self):
     self.portal.invokeFactory('Document', 'doc-1')
     doc = self.portal['doc-1']
     view = api.content.get_view('view', doc, self.request)
     rendered = view()
     self.assertIn('rel="canonical" href="http://nohost', rendered)
     behavior = ICanonicalURL(doc)
     behavior.canonical_url = u'http://www.simplesconsultoria.com.br/'
     view = api.content.get_view('view', doc, self.request)
     rendered = view()
     self.assertIn('rel="canonical" href="http://www.simplesconsultoria', rendered)