def check_template_meta_image_url(self, expected_root):
        """Template meta tags should use an absolute image URL."""
        image_file = get_test_image_file(filename='foo.png')
        image = baker.make(CFGOVImage, file=image_file)
        page = LearnPage(social_sharing_image=image)
        response = page.make_preview_request()
        response.render()

        rendition_url = image.get_rendition('original').url

        self.assertContains(response,
                            ('<meta property="og:image" content='
                             '"{}{}">'.format(expected_root, rendition_url)),
                            html=True)
    def test_template_meta_image_no_images(self):
        """Template meta tags should fallback to standard social networks."""
        page = LearnPage(social_sharing_image=None)
        response = page.make_preview_request()
        response.render()

        self.assertContains(
            response,
            ('<meta property="og:image" content='
             '"http://localhost/static/img/logo_open-graph_facebook.png">'),
            html=True)

        self.assertContains(
            response,
            ('<meta property="twitter:image" content='
             '"http://localhost/static/img/logo_open-graph_twitter.png">'),
            html=True)