Mercurial > libervia-backend
diff sat/test/test_plugin_xep_0277.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | 003b8b4b56a7 |
line wrap: on
line diff
--- a/sat/test/test_plugin_xep_0277.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/test/test_plugin_xep_0277.py Wed Jun 27 20:14:46 2018 +0200 @@ -29,7 +29,8 @@ class XEP_0277Test(helpers.SatTestCase): - PUBSUB_ENTRY_1 = u""" + PUBSUB_ENTRY_1 = ( + u""" <item id="c745a688-9b02-11e3-a1a3-c0143dd4fe51"> <entry xmlns="%s"> <title type="text"><span>titre</span></title> @@ -43,9 +44,12 @@ </author> </entry> </item> - """ % plugin_xep_0277.NS_ATOM + """ + % plugin_xep_0277.NS_ATOM + ) - PUBSUB_ENTRY_2 = u""" + PUBSUB_ENTRY_2 = ( + u""" <item id="c745a688-9b02-11e3-a1a3-c0143dd4fe51"> <entry xmlns='%s'> <title type="text"><div>titre</div></title> @@ -61,7 +65,9 @@ </author> </entry> </item> - """ % plugin_xep_0277.NS_ATOM + """ + % plugin_xep_0277.NS_ATOM + ) def setUp(self): self.host = helpers.FakeSAT() @@ -72,39 +78,48 @@ def addPEPEvent(self, *args): pass + self.host.plugins["XEP-0060"] = plugin_xep_0060.XEP_0060(self.host) self.host.plugins["XEP-0163"] = XEP_0163(self.host) reload(plugin_misc_text_syntaxes) # reload the plugin to avoid conflict error - self.host.plugins["TEXT-SYNTAXES"] = plugin_misc_text_syntaxes.TextSyntaxes(self.host) + self.host.plugins["TEXT-SYNTAXES"] = plugin_misc_text_syntaxes.TextSyntaxes( + self.host + ) self.plugin = plugin_xep_0277.XEP_0277(self.host) def test_item2mbdata_1(self): - expected = {u'id': u'c745a688-9b02-11e3-a1a3-c0143dd4fe51', - u'atom_id': u'c745a688-9b02-11e3-a1a3-c0143dd4fe51', - u'title': u'<span>titre</span>', - u'updated': u'1392992199.0', - u'published': u'1392992198.0', - u'content': u'<p>contenu</p>texte sans balise<p>autre contenu</p>', - u'content_xhtml': u'<div><p>contenu</p>texte sans balise<p>autre contenu</p></div>', - u'author': u'test1@souliane.org' - } - item_elt = ElementParser()(self.PUBSUB_ENTRY_1, namespace=NS_PUBSUB).elements().next() + expected = { + u"id": u"c745a688-9b02-11e3-a1a3-c0143dd4fe51", + u"atom_id": u"c745a688-9b02-11e3-a1a3-c0143dd4fe51", + u"title": u"<span>titre</span>", + u"updated": u"1392992199.0", + u"published": u"1392992198.0", + u"content": u"<p>contenu</p>texte sans balise<p>autre contenu</p>", + u"content_xhtml": u"<div><p>contenu</p>texte sans balise<p>autre contenu</p></div>", + u"author": u"test1@souliane.org", + } + item_elt = ( + ElementParser()(self.PUBSUB_ENTRY_1, namespace=NS_PUBSUB).elements().next() + ) d = self.plugin.item2mbdata(item_elt) d.addCallback(self.assertEqual, expected) return d def test_item2mbdata_2(self): - expected = {u'id': u'c745a688-9b02-11e3-a1a3-c0143dd4fe51', - u'atom_id': u'c745a688-9b02-11e3-a1a3-c0143dd4fe51', - u'title': u'<div>titre</div>', - u'title_xhtml': u'<div><div style="">titre</div></div>', - u'updated': u'1392992199.0', - u'published': u'1392992198.0', - u'content': u'<div><p>contenu</p>texte dans balise<p>autre contenu</p></div>', - u'content_xhtml': u'<div><p>contenu</p>texte dans balise<p>autre contenu</p></div>', - u'author': u'test1@souliane.org' - } - item_elt = ElementParser()(self.PUBSUB_ENTRY_2, namespace=NS_PUBSUB).elements().next() + expected = { + u"id": u"c745a688-9b02-11e3-a1a3-c0143dd4fe51", + u"atom_id": u"c745a688-9b02-11e3-a1a3-c0143dd4fe51", + u"title": u"<div>titre</div>", + u"title_xhtml": u'<div><div style="">titre</div></div>', + u"updated": u"1392992199.0", + u"published": u"1392992198.0", + u"content": u"<div><p>contenu</p>texte dans balise<p>autre contenu</p></div>", + u"content_xhtml": u"<div><p>contenu</p>texte dans balise<p>autre contenu</p></div>", + u"author": u"test1@souliane.org", + } + item_elt = ( + ElementParser()(self.PUBSUB_ENTRY_2, namespace=NS_PUBSUB).elements().next() + ) d = self.plugin.item2mbdata(item_elt) d.addCallback(self.assertEqual, expected) return d