1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test_preview.py b/tests/test_preview.py
index ffa52e5dd4..5bd36c74aa 100644
--- a/tests/test_preview.py
+++ b/tests/test_preview.py
@@ -215,3 +215,53 @@ class PreviewUrlTestCase(unittest.TestCase):
u"og:title": u"Foo",
u"og:description": u"Some text."
})
+
+ def test_missing_title(self):
+ html = u"""
+ <html>
+ <body>
+ Some text.
+ </body>
+ </html>
+ """
+
+ og = decode_and_calc_og(html, "http://example.com/test.html")
+
+ self.assertEquals(og, {
+ u"og:title": None,
+ u"og:description": u"Some text."
+ })
+
+ def test_h1_as_title(self):
+ html = u"""
+ <html>
+ <meta property="og:description" content="Some text."/>
+ <body>
+ <h1>Title</h1>
+ </body>
+ </html>
+ """
+
+ og = decode_and_calc_og(html, "http://example.com/test.html")
+
+ self.assertEquals(og, {
+ u"og:title": u"Title",
+ u"og:description": u"Some text."
+ })
+
+ def test_missing_title_and_broken_h1(self):
+ html = u"""
+ <html>
+ <body>
+ <h1><a href="foo"/></h1>
+ Some text.
+ </body>
+ </html>
+ """
+
+ og = decode_and_calc_og(html, "http://example.com/test.html")
+
+ self.assertEquals(og, {
+ u"og:title": None,
+ u"og:description": u"Some text."
+ })
|