def test_html(self): a = OpenGraphItem() a.set('og:title', 'MyWebsite') a.set('og:type', 'article') a.set('og:description', 'one two three four ? <open >close') a.set_many(( ('og:url', 'http://f.me'), ('og:image', 'http://f.me/a.png'), ('article:author', 'abc'), ('article:published_time', '2012-01-10') )) status = a.validate() assert status is True as_html = a.as_html() assert as_html == """<meta property="article:author" content="abc"/>
def test_set_multi(self): a = OpenGraphItem() a.set_many(( ('og:url', 'http://f.me'), ('og:image', 'http://f.me/a.png'), ('og:title', 'MyWebsite'), ('og:type', 'article'), )) a.set('og:tag', 'One', append=True) a.set('og:tag', 'Two', append=True) a.set('og:tag', 'Three', append=True) status = a.validate() assert status is True as_html = a.as_html() assert as_html == """<meta property="og:image" content="http://f.me/a.png"/>