Beispiel #1
0
    def test_links_get_expanded(self):
        page = SimplePage(title='foo', slug='foo', content='content')
        default_site = Site.objects.get(is_default_site=True)
        default_site.root_page.add_child(instance=page)

        html = '<a linktype="page" id="{}">Link</a>'.format(page.pk)
        block = ReusableTextChooserBlock(ReusableText)
        self.assertIn('<a href="/foo/">', block.render({'text': html}))
Beispiel #2
0
 def test_lack_of_heading(self):
     sidefoot_heading = None
     html = '<p>This is the text of the reusable snippet.</p>'
     block = ReusableTextChooserBlock(ReusableText)
     self.assertNotIn(
         '<h2 class="a-heading">',
         block.render({
             'sidefoot_heading': sidefoot_heading,
             'text': html
         }))
Beispiel #3
0
 def test_nonexistent_links_return_empty_link(self):
     html = '<a linktype="page" id="12345">Link</a>'
     block = ReusableTextChooserBlock(ReusableText)
     self.assertIn('<a>', block.render({'text': html}))