comparison sat/test/test_plugin_xep_0203.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
comparison
equal deleted inserted replaced
2623:49533de4540b 2624:56f94936df1e
25 from twisted.words.xish import domish 25 from twisted.words.xish import domish
26 from twisted.words.protocols.jabber.jid import JID 26 from twisted.words.protocols.jabber.jid import JID
27 from dateutil.tz import tzutc 27 from dateutil.tz import tzutc
28 import datetime 28 import datetime
29 29
30 NS_PUBSUB = 'http://jabber.org/protocol/pubsub' 30 NS_PUBSUB = "http://jabber.org/protocol/pubsub"
31 31
32 32
33 class XEP_0203Test(helpers.SatTestCase): 33 class XEP_0203Test(helpers.SatTestCase):
34
35 def setUp(self): 34 def setUp(self):
36 self.host = helpers.FakeSAT() 35 self.host = helpers.FakeSAT()
37 self.plugin = XEP_0203(self.host) 36 self.plugin = XEP_0203(self.host)
38 37
39 def test_delay(self): 38 def test_delay(self):
42 from='capulet.com' 41 from='capulet.com'
43 stamp='2002-09-10T23:08:25Z'> 42 stamp='2002-09-10T23:08:25Z'>
44 Offline Storage 43 Offline Storage
45 </delay> 44 </delay>
46 """ 45 """
47 message_xml = """ 46 message_xml = (
47 """
48 <message 48 <message
49 from='romeo@montague.net/orchard' 49 from='romeo@montague.net/orchard'
50 to='juliet@capulet.com' 50 to='juliet@capulet.com'
51 type='chat'> 51 type='chat'>
52 <body>text</body> 52 <body>text</body>
53 %s 53 %s
54 </message> 54 </message>
55 """ % delay_xml 55 """
56 % delay_xml
57 )
56 58
57 parent = domish.Element((None, 'message')) 59 parent = domish.Element((None, "message"))
58 parent['from'] = 'romeo@montague.net/orchard' 60 parent["from"] = "romeo@montague.net/orchard"
59 parent['to'] = 'juliet@capulet.com' 61 parent["to"] = "juliet@capulet.com"
60 parent['type'] = 'chat' 62 parent["type"] = "chat"
61 parent.addElement('body', None, 'text') 63 parent.addElement("body", None, "text")
62 stamp = datetime.datetime(2002, 9, 10, 23, 8, 25, tzinfo=tzutc()) 64 stamp = datetime.datetime(2002, 9, 10, 23, 8, 25, tzinfo=tzutc())
63 elt = self.plugin.delay(stamp, JID('capulet.com'), 'Offline Storage', parent) 65 elt = self.plugin.delay(stamp, JID("capulet.com"), "Offline Storage", parent)
64 self.assertEqualXML(elt.toXml(), delay_xml, True) 66 self.assertEqualXML(elt.toXml(), delay_xml, True)
65 self.assertEqualXML(parent.toXml(), message_xml, True) 67 self.assertEqualXML(parent.toXml(), message_xml, True)