def check_link_makes_button(self):
     url = 'http://test.domain/slug/'
     with patch('wagtailsharing.wagtail_hooks.get_sharing_url',
                return_value=url):
         links = add_sharing_link(self.page, self.page_perms)
         button = next(links)
         self.assertEqual(button.url, url)
         self.assertIn(self.page.title, button.attrs['title'])
 def test_link_makes_button(self):
     url = "http://test.domain/slug/"
     with patch("wagtailsharing.wagtail_hooks.get_sharing_url",
                return_value=url):
         links = add_sharing_link(self.page, self.page_perms)
         button = next(links)
         self.assertEqual(button.url, url)
         self.assertIn(self.page.get_admin_display_title(),
                       button.attrs["title"])
 def test_no_link_no_button(self):
     with patch("wagtailsharing.wagtail_hooks.get_sharing_url",
                return_value=None):
         links = add_sharing_link(self.page, self.page_perms)
         self.assertFalse(list(links))