Mercurial > libervia-backend
diff sat/test/test_plugin_xep_0334.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 | 378188abe941 |
line wrap: on
line diff
--- a/sat/test/test_plugin_xep_0334.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/test/test_plugin_xep_0334.py Wed Jun 27 20:14:46 2018 +0200 @@ -27,11 +27,10 @@ from wokkel.generic import parseXml from sat.core import exceptions -HINTS = ('no-permanent-storage', 'no-storage', 'no-copy') +HINTS = ("no-permanent-storage", "no-storage", "no-copy") class XEP_0334Test(helpers.SatTestCase): - def setUp(self): self.host = helpers.FakeSAT() self.plugin = XEP_0334(self.host) @@ -46,20 +45,23 @@ %s </message> """ - original_xml = template_xml % '' + original_xml = template_xml % "" d_list = [] def cb(data, expected_xml): - result_xml = data['xml'].toXml().encode("utf-8") + result_xml = data["xml"].toXml().encode("utf-8") self.assertEqualXML(result_xml, expected_xml, True) - for key in (HINTS + ('', 'dummy_hint')): - mess_data = {'xml': parseXml(original_xml.encode("utf-8")), - 'extra': {key: True} - } + for key in HINTS + ("", "dummy_hint"): + mess_data = { + "xml": parseXml(original_xml.encode("utf-8")), + "extra": {key: True}, + } treatments = defer.Deferred() - self.plugin.messageSendTrigger(self.host.getClient(C.PROFILE[0]), mess_data, defer.Deferred(), treatments) + self.plugin.messageSendTrigger( + self.host.getClient(C.PROFILE[0]), mess_data, defer.Deferred(), treatments + ) if treatments.callbacks: # the trigger added a callback expected_xml = template_xml % ('<%s xmlns="urn:xmpp:hints"/>' % key) treatments.addCallback(cb, expected_xml) @@ -87,16 +89,18 @@ d_list = [] - for key in (HINTS + ('dummy_hint',)): + for key in HINTS + ("dummy_hint",): message = parseXml(template_xml % ('<%s xmlns="urn:xmpp:hints"/>' % key)) post_treat = defer.Deferred() - self.plugin.messageReceivedTrigger(self.host.getClient(C.PROFILE[0]), message, post_treat) + self.plugin.messageReceivedTrigger( + self.host.getClient(C.PROFILE[0]), message, post_treat + ) if post_treat.callbacks: - assert(key in ('no-permanent-storage', 'no-storage')) + assert key in ("no-permanent-storage", "no-storage") post_treat.addCallbacks(cb, eb) post_treat.callback(None) d_list.append(post_treat) else: - assert(key not in ('no-permanent-storage', 'no-storage')) + assert key not in ("no-permanent-storage", "no-storage") return defer.DeferredList(d_list)