def test_should_limit_the_summary_content_when_using_it_as_description(self):
        self.article.summary = """<p>Do you see any "Teletubbies" in here? Do you
        see a slender plastic tag clipped to my shirt with my name printed on
        it? Do you see a little Asian child with a blank expression on his
        face sitting outside on a mechanical helicopter that shakes when you
        put quarters in it? No? Well, that's what you see at a toy store.
        And you must think you're in a toy store, because you're here shopping
        for an infant named Jeb.<p>"""
        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(
            self.article.meta["description"],
            "Do you see any &#34;Teletubbies&#34; in here? Do you see a slender plastic tag clipped to my shirt with my name printed on it? Do you see a little Asian child with...",
        )
 def setUp(self):
     super(ExtendedMetaUnfilledMetaTestCase, self).setUp()
     ExtendedMeta.create_meta_attribute(self.article)
    def test_should_create_meta_ogimage_on_article_when_it_has_og_image(self):
        self.article.meta_og_image = "http://mycustomdomain/og.jpg"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_image"], "http://mycustomdomain/og.jpg")
    def test_should_create_meta_ogurl_on_article_when_it_has_og_url(self):
        self.article.meta_og_url = "http://mycustomdomain/should-be-article-url.html"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_url"], "http://mycustomdomain/should-be-article-url.html")
    def test_should_create_meta_ogdescription_on_article_when_it_has_og_description(self):
        self.article.meta_og_description = "should-be-meta-og-description"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_description"], "should-be-meta-og-description")
    def test_should_create_meta_ogtitle_on_article_when_it_has_og_title(self):
        self.article.meta_og_title = "should-be-meta-og-title"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_title"], "should-be-meta-og-title")
    def test_should_create_meta_canonical(self):
        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["canonical"], "http://localhost/should-be-the-article-url.html")
    def test_should_create_meta_robots_on_article_when_it_has_robots(self):
        self.article.meta_robots = "index,follow"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["robots"], "index,follow")
    def test_should_create_meta_attribute_on_article_when_it_has_keywords(self):
        self.article.meta_keywords = "should-be-meta-keywords"

        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["keywords"], "should-be-meta-keywords")
    def test_should_create_meta_attribute_with_data_on_articles(self):
        ExtendedMeta.add_meta_to_articles(self.generator)

        for article in self.generator.articles:
            self.assertEqual(article.meta["description"], "should-be-description")
    def test_should_use_the_default_image_as_ogimage_when_article_hasnt_one(self):
        self.article.content = "<p>Lorem ipsum</p>"
        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_image"], "should-be-default-og-image.jpg")
    def test_should_use_the_first_image_of_the_article(self):
        self.article.content = """<h1>hey!</h1><p><div><img src="http://myhost/1.jpg"></div>
        </p><br><img src="2.jpg">"""
        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["og_image"], "http://myhost/1.jpg")
    def test_should_format_the_summary_to_use_as_description(self):
        self.article.summary = '<p>This is a "test"! <strong>Just a test!</strong></p>'
        ExtendedMeta.create_meta_attribute(self.article)

        self.assertEqual(self.article.meta["description"], "This is a &#34;test&#34;! Just a test!")