comparison sat/test/test_plugin_xep_0313.py @ 2765:378188abe941

misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)
author Goffi <goffi@goffi.org>
date Fri, 11 Jan 2019 11:13:15 +0100
parents 56f94936df1e
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2764:92af49cde255 2765:378188abe941
55 ("H_%d" % domish.Element._idCounter), 55 ("H_%d" % domish.Element._idCounter),
56 SERVICE, 56 SERVICE,
57 ) 57 )
58 d = self.plugin.queryArchive(self.client, MAMRequest(), SERVICE_JID) 58 d = self.plugin.queryArchive(self.client, MAMRequest(), SERVICE_JID)
59 d.addCallback( 59 d.addCallback(
60 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 60 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
61 ) 61 )
62 return d 62 return d
63 63
64 def test_queryArchivePubsub(self): 64 def test_queryArchivePubsub(self):
65 xml = """ 65 xml = """
72 ) 72 )
73 d = self.plugin.queryArchive( 73 d = self.plugin.queryArchive(
74 self.client, MAMRequest(node="fdp/submitted/capulet.lit/sonnets"), SERVICE_JID 74 self.client, MAMRequest(node="fdp/submitted/capulet.lit/sonnets"), SERVICE_JID
75 ) 75 )
76 d.addCallback( 76 d.addCallback(
77 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 77 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
78 ) 78 )
79 return d 79 return d
80 80
81 def test_queryArchiveWith(self): 81 def test_queryArchiveWith(self):
82 xml = """ 82 xml = """
97 SERVICE, 97 SERVICE,
98 ) 98 )
99 form = buildForm(with_jid=JID("juliet@capulet.lit")) 99 form = buildForm(with_jid=JID("juliet@capulet.lit"))
100 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID) 100 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID)
101 d.addCallback( 101 d.addCallback(
102 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 102 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
103 ) 103 )
104 return d 104 return d
105 105
106 def test_queryArchiveStartEnd(self): 106 def test_queryArchiveStartEnd(self):
107 xml = """ 107 xml = """
127 start = datetime.datetime(2010, 6, 7, 0, 0, 0, tzinfo=tzutc()) 127 start = datetime.datetime(2010, 6, 7, 0, 0, 0, tzinfo=tzutc())
128 end = datetime.datetime(2010, 7, 7, 13, 23, 54, tzinfo=tzutc()) 128 end = datetime.datetime(2010, 7, 7, 13, 23, 54, tzinfo=tzutc())
129 form = buildForm(start=start, end=end) 129 form = buildForm(start=start, end=end)
130 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID) 130 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID)
131 d.addCallback( 131 d.addCallback(
132 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 132 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
133 ) 133 )
134 return d 134 return d
135 135
136 def test_queryArchiveStart(self): 136 def test_queryArchiveStart(self):
137 xml = """ 137 xml = """
153 ) 153 )
154 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc()) 154 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc())
155 form = buildForm(start=start) 155 form = buildForm(start=start)
156 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID) 156 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID)
157 d.addCallback( 157 d.addCallback(
158 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 158 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
159 ) 159 )
160 return d 160 return d
161 161
162 def test_queryArchiveRSM(self): 162 def test_queryArchiveRSM(self):
163 xml = """ 163 xml = """
183 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc()) 183 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc())
184 form = buildForm(start=start) 184 form = buildForm(start=start)
185 rsm = RSMRequest(max_=10) 185 rsm = RSMRequest(max_=10)
186 d = self.plugin.queryArchive(self.client, MAMRequest(form, rsm), SERVICE_JID) 186 d = self.plugin.queryArchive(self.client, MAMRequest(form, rsm), SERVICE_JID)
187 d.addCallback( 187 d.addCallback(
188 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 188 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
189 ) 189 )
190 return d 190 return d
191 191
192 def test_queryArchiveRSMPaging(self): 192 def test_queryArchiveRSMPaging(self):
193 xml = """ 193 xml = """
210 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc()) 210 start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc())
211 form = buildForm(start=start) 211 form = buildForm(start=start)
212 rsm = RSMRequest(max_=10, after=u"09af3-cc343-b409f") 212 rsm = RSMRequest(max_=10, after=u"09af3-cc343-b409f")
213 d = self.plugin.queryArchive(self.client, MAMRequest(form, rsm), SERVICE_JID) 213 d = self.plugin.queryArchive(self.client, MAMRequest(form, rsm), SERVICE_JID)
214 d.addCallback( 214 d.addCallback(
215 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 215 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
216 ) 216 )
217 return d 217 return d
218 218
219 def test_queryFields(self): 219 def test_queryFields(self):
220 xml = """ 220 xml = """
225 ("H_%d" % domish.Element._idCounter), 225 ("H_%d" % domish.Element._idCounter),
226 SERVICE, 226 SERVICE,
227 ) 227 )
228 d = self.plugin.queryFields(self.client, SERVICE_JID) 228 d = self.plugin.queryFields(self.client, SERVICE_JID)
229 d.addCallback( 229 d.addCallback(
230 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 230 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
231 ) 231 )
232 return d 232 return d
233 233
234 def test_queryArchiveFields(self): 234 def test_queryArchiveFields(self):
235 xml = """ 235 xml = """
265 ), 265 ),
266 ] 266 ]
267 form = buildForm(extra_fields=extra_fields) 267 form = buildForm(extra_fields=extra_fields)
268 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID) 268 d = self.plugin.queryArchive(self.client, MAMRequest(form), SERVICE_JID)
269 d.addCallback( 269 d.addCallback(
270 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 270 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
271 ) 271 )
272 return d 272 return d
273 273
274 def test_queryPrefs(self): 274 def test_queryPrefs(self):
275 xml = """ 275 xml = """
283 ("H_%d" % domish.Element._idCounter), 283 ("H_%d" % domish.Element._idCounter),
284 SERVICE, 284 SERVICE,
285 ) 285 )
286 d = self.plugin.getPrefs(self.client, SERVICE_JID) 286 d = self.plugin.getPrefs(self.client, SERVICE_JID)
287 d.addCallback( 287 d.addCallback(
288 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 288 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
289 ) 289 )
290 return d 290 return d
291 291
292 def test_setPrefs(self): 292 def test_setPrefs(self):
293 xml = """ 293 xml = """
307 ) 307 )
308 always = [JID("romeo@montague.lit")] 308 always = [JID("romeo@montague.lit")]
309 never = [JID("montague@montague.lit")] 309 never = [JID("montague@montague.lit")]
310 d = self.plugin.setPrefs(self.client, SERVICE_JID, always=always, never=never) 310 d = self.plugin.setPrefs(self.client, SERVICE_JID, always=always, never=never)
311 d.addCallback( 311 d.addCallback(
312 lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True) 312 lambda __: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True)
313 ) 313 )
314 return d 314 return d