Rename to slixmpp
[slixmpp.git] / tests / test_stream_xep_0060.py
blob17cb5b2c63705ea42a73f0e180899c07c4c4b286
1 import threading
3 import unittest
4 from slixmpp.test import SlixTest
5 from slixmpp.stanza.atom import AtomEntry
6 from slixmpp.xmlstream import register_stanza_plugin
9 class TestStreamPubsub(SlixTest):
11 """
12 Test using the XEP-0030 plugin.
13 """
15 def setUp(self):
16 self.stream_start()
18 def tearDown(self):
19 self.stream_close()
21 def testCreateInstantNode(self):
22 """Test creating an instant node"""
23 t = threading.Thread(name='create_node',
24 target=self.xmpp['xep_0060'].create_node,
25 args=('pubsub.example.com', None))
26 t.start()
28 self.send("""
29 <iq type="set" id="1" to="pubsub.example.com">
30 <pubsub xmlns="http://jabber.org/protocol/pubsub">
31 <create />
32 </pubsub>
33 </iq>
34 """)
36 self.recv("""
37 <iq type="result" id="1"
38 to="tester@localhost" from="pubsub.example.com">
39 <pubsub xmlns="http://jabber.org/protocol/pubsub">
40 <create node="25e3d37dabbab9541f7523321421edc5bfeb2dae" />
41 </pubsub>
42 </iq>
43 """)
45 t.join()
47 def testCreateNodeNoConfig(self):
48 """Test creating a node without a config"""
49 self.xmpp['xep_0060'].create_node(
50 'pubsub.example.com',
51 'princely_musings',
52 block=False)
53 self.send("""
54 <iq type="set" id="1" to="pubsub.example.com">
55 <pubsub xmlns="http://jabber.org/protocol/pubsub">
56 <create node="princely_musings" />
57 </pubsub>
58 </iq>
59 """)
61 def testCreateNodeConfig(self):
62 """Test creating a node with a config"""
63 form = self.xmpp['xep_0004'].stanza.Form()
64 form['type'] = 'submit'
65 form.add_field(var='pubsub#access_model', value='whitelist')
67 self.xmpp['xep_0060'].create_node(
68 'pubsub.example.com',
69 'princely_musings',
70 config=form, block=False)
72 self.send("""
73 <iq type="set" id="1" to="pubsub.example.com">
74 <pubsub xmlns="http://jabber.org/protocol/pubsub">
75 <create node="princely_musings" />
76 <configure>
77 <x xmlns="jabber:x:data" type="submit">
78 <field var="pubsub#access_model">
79 <value>whitelist</value>
80 </field>
81 <field var="FORM_TYPE">
82 <value>http://jabber.org/protocol/pubsub#node_config</value>
83 </field>
84 </x>
85 </configure>
86 </pubsub>
87 </iq>
88 """)
90 def testDeleteNode(self):
91 """Test deleting a node"""
92 self.xmpp['xep_0060'].delete_node(
93 'pubsub.example.com',
94 'some_node',
95 block=False)
96 self.send("""
97 <iq type="set" to="pubsub.example.com" id="1">
98 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
99 <delete node="some_node" />
100 </pubsub>
101 </iq>
102 """)
104 def testSubscribeCase1(self):
106 Test subscribing to a node: Case 1:
107 No subscribee, default 'from' JID, bare JID
109 self.xmpp['xep_0060'].subscribe(
110 'pubsub.example.com',
111 'somenode',
112 block=False)
113 self.send("""
114 <iq type="set" id="1" to="pubsub.example.com">
115 <pubsub xmlns="http://jabber.org/protocol/pubsub">
116 <subscribe node="somenode" jid="tester@localhost" />
117 </pubsub>
118 </iq>
119 """)
121 def testSubscribeCase2(self):
123 Test subscribing to a node: Case 2:
124 No subscribee, given 'from' JID, bare JID
126 self.xmpp['xep_0060'].subscribe(
127 'pubsub.example.com',
128 'somenode',
129 ifrom='foo@comp.example.com/bar',
130 block=False)
131 self.send("""
132 <iq type="set" id="1"
133 to="pubsub.example.com" from="foo@comp.example.com/bar">
134 <pubsub xmlns="http://jabber.org/protocol/pubsub">
135 <subscribe node="somenode" jid="foo@comp.example.com" />
136 </pubsub>
137 </iq>
138 """)
140 def testSubscribeCase3(self):
142 Test subscribing to a node: Case 3:
143 No subscribee, given 'from' JID, full JID
145 self.xmpp['xep_0060'].subscribe(
146 'pubsub.example.com',
147 'somenode',
148 ifrom='foo@comp.example.com/bar',
149 bare=False,
150 block=False)
151 self.send("""
152 <iq type="set" id="1"
153 to="pubsub.example.com" from="foo@comp.example.com/bar">
154 <pubsub xmlns="http://jabber.org/protocol/pubsub">
155 <subscribe node="somenode" jid="foo@comp.example.com/bar" />
156 </pubsub>
157 </iq>
158 """)
160 def testSubscribeCase4(self):
162 Test subscribing to a node: Case 4:
163 No subscribee, no 'from' JID, full JID
165 self.stream_close()
166 self.stream_start(jid='tester@localhost/full')
168 self.xmpp['xep_0060'].subscribe(
169 'pubsub.example.com',
170 'somenode',
171 bare=False,
172 block=False)
173 self.send("""
174 <iq type="set" id="1"
175 to="pubsub.example.com">
176 <pubsub xmlns="http://jabber.org/protocol/pubsub">
177 <subscribe node="somenode" jid="tester@localhost/full" />
178 </pubsub>
179 </iq>
180 """)
182 def testSubscribeCase5(self):
184 Test subscribing to a node: Case 5:
185 Subscribee given
187 self.xmpp['xep_0060'].subscribe(
188 'pubsub.example.com',
189 'somenode',
190 subscribee='user@example.com/foo',
191 ifrom='foo@comp.example.com/bar',
192 block=False)
193 self.send("""
194 <iq type="set" id="1"
195 to="pubsub.example.com" from="foo@comp.example.com/bar">
196 <pubsub xmlns="http://jabber.org/protocol/pubsub">
197 <subscribe node="somenode" jid="user@example.com/foo" />
198 </pubsub>
199 </iq>
200 """)
202 def testSubscribeWithOptions(self):
203 """Test subscribing to a node, with options."""
204 opts = self.xmpp['xep_0004'].make_form()
205 opts.add_field(
206 var='FORM_TYPE',
207 value='http://jabber.org/protocol/pubsub#subscribe_options',
208 ftype='hidden')
209 opts.add_field(
210 var='pubsub#digest',
211 value=False,
212 ftype='boolean')
213 opts['type'] = 'submit'
215 self.xmpp['xep_0060'].subscribe(
216 'pubsub.example.com',
217 'somenode',
218 options=opts,
219 block=False)
220 self.send("""
221 <iq type="set" id="1" to="pubsub.example.com">
222 <pubsub xmlns="http://jabber.org/protocol/pubsub">
223 <subscribe node="somenode" jid="tester@localhost" />
224 <options>
225 <x xmlns="jabber:x:data" type="submit">
226 <field var="FORM_TYPE">
227 <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
228 </field>
229 <field var="pubsub#digest">
230 <value>0</value>
231 </field>
232 </x>
233 </options>
234 </pubsub>
235 </iq>
236 """)
238 def testUnsubscribeCase1(self):
240 Test unsubscribing from a node: Case 1:
241 No subscribee, default 'from' JID, bare JID
243 self.xmpp['xep_0060'].unsubscribe(
244 'pubsub.example.com',
245 'somenode',
246 block=False)
247 self.send("""
248 <iq type="set" id="1" to="pubsub.example.com">
249 <pubsub xmlns="http://jabber.org/protocol/pubsub">
250 <unsubscribe node="somenode" jid="tester@localhost" />
251 </pubsub>
252 </iq>
253 """)
255 def testUnsubscribeCase2(self):
257 Test unsubscribing from a node: Case 2:
258 No subscribee, given 'from' JID, bare JID
260 self.xmpp['xep_0060'].unsubscribe(
261 'pubsub.example.com',
262 'somenode',
263 ifrom='foo@comp.example.com/bar',
264 block=False)
265 self.send("""
266 <iq type="set" id="1"
267 to="pubsub.example.com" from="foo@comp.example.com/bar">
268 <pubsub xmlns="http://jabber.org/protocol/pubsub">
269 <unsubscribe node="somenode" jid="foo@comp.example.com" />
270 </pubsub>
271 </iq>
272 """)
274 def testUnsubscribeCase3(self):
276 Test unsubscribing from a node: Case 3:
277 No subscribee, given 'from' JID, full JID
279 self.xmpp['xep_0060'].unsubscribe(
280 'pubsub.example.com',
281 'somenode',
282 ifrom='foo@comp.example.com/bar',
283 bare=False,
284 block=False)
285 self.send("""
286 <iq type="set" id="1"
287 to="pubsub.example.com" from="foo@comp.example.com/bar">
288 <pubsub xmlns="http://jabber.org/protocol/pubsub">
289 <unsubscribe node="somenode" jid="foo@comp.example.com/bar" />
290 </pubsub>
291 </iq>
292 """)
294 def testUnsubscribeCase4(self):
296 Test unsubscribing from a node: Case 4:
297 No subscribee, no 'from' JID, full JID
299 self.stream_close()
300 self.stream_start(jid='tester@localhost/full')
302 self.xmpp['xep_0060'].unsubscribe(
303 'pubsub.example.com',
304 'somenode',
305 bare=False,
306 block=False)
307 self.send("""
308 <iq type="set" id="1"
309 to="pubsub.example.com">
310 <pubsub xmlns="http://jabber.org/protocol/pubsub">
311 <unsubscribe node="somenode" jid="tester@localhost/full" />
312 </pubsub>
313 </iq>
314 """)
316 def testUnsubscribeCase5(self):
318 Test unsubscribing from a node: Case 5:
319 Subscribee given
321 self.xmpp['xep_0060'].unsubscribe(
322 'pubsub.example.com',
323 'somenode',
324 subscribee='user@example.com/foo',
325 ifrom='foo@comp.example.com/bar',
326 block=False)
327 self.send("""
328 <iq type="set" id="1"
329 to="pubsub.example.com" from="foo@comp.example.com/bar">
330 <pubsub xmlns="http://jabber.org/protocol/pubsub">
331 <unsubscribe node="somenode" jid="user@example.com/foo" />
332 </pubsub>
333 </iq>
334 """)
336 def testGetDefaultNodeConfig(self):
337 """Test retrieving the default node config for a pubsub service."""
338 self.xmpp['xep_0060'].get_node_config(
339 'pubsub.example.com',
340 block=False)
341 self.send("""
342 <iq type="get" id="1" to="pubsub.example.com">
343 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
344 <default />
345 </pubsub>
346 </iq>
347 """, use_values=False)
349 def testGetNodeConfig(self):
350 """Test getting the config for a given node."""
351 self.xmpp['xep_0060'].get_node_config(
352 'pubsub.example.com',
353 'somenode',
354 block=False)
355 self.send("""
356 <iq type="get" id="1" to="pubsub.example.com">
357 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
358 <configure node="somenode" />
359 </pubsub>
360 </iq>
361 """, use_values=False)
363 def testSetNodeConfig(self):
364 """Test setting the configuration for a node."""
365 form = self.xmpp['xep_0004'].make_form()
366 form.add_field(var='FORM_TYPE', ftype='hidden',
367 value='http://jabber.org/protocol/pubsub#node_config')
368 form.add_field(var='pubsub#title', ftype='text-single',
369 value='This is awesome!')
370 form['type'] = 'submit'
372 self.xmpp['xep_0060'].set_node_config(
373 'pubsub.example.com',
374 'somenode',
375 form,
376 block=False)
377 self.send("""
378 <iq type="set" id="1" to="pubsub.example.com">
379 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
380 <configure node="somenode">
381 <x xmlns="jabber:x:data" type="submit">
382 <field var="FORM_TYPE">
383 <value>http://jabber.org/protocol/pubsub#node_config</value>
384 </field>
385 <field var="pubsub#title">
386 <value>This is awesome!</value>
387 </field>
388 </x>
389 </configure>
390 </pubsub>
391 </iq>
392 """)
394 def testPublishNoItems(self):
395 """Test publishing no items (in order to generate events)"""
396 self.xmpp['xep_0060'].publish(
397 'pubsub.example.com',
398 'somenode',
399 block=False)
400 self.send("""
401 <iq type="set" id="1" to="pubsub.example.com">
402 <pubsub xmlns="http://jabber.org/protocol/pubsub">
403 <publish node="somenode" />
404 </pubsub>
405 </iq>
406 """)
408 def testPublishSingle(self):
409 """Test publishing a single item."""
410 payload = AtomEntry()
411 payload['title'] = 'Test'
413 register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
415 self.xmpp['xep_0060'].publish(
416 'pubsub.example.com',
417 'somenode',
418 id='id42',
419 payload=payload,
420 block=False)
421 self.send("""
422 <iq type="set" id="1" to="pubsub.example.com">
423 <pubsub xmlns="http://jabber.org/protocol/pubsub">
424 <publish node="somenode">
425 <item id="id42">
426 <entry xmlns="http://www.w3.org/2005/Atom">
427 <title>Test</title>
428 </entry>
429 </item>
430 </publish>
431 </pubsub>
432 </iq>
433 """, use_values=False)
435 def testPublishSingleOptions(self):
436 """Test publishing a single item, with options."""
437 payload = AtomEntry()
438 payload['title'] = 'Test'
440 register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
442 options = self.xmpp['xep_0004'].make_form()
443 options.add_field(var='FORM_TYPE', ftype='hidden',
444 value='http://jabber.org/protocol/pubsub#publish-options')
445 options.add_field(var='pubsub#access_model', ftype='text-single',
446 value='presence')
447 options['type'] = 'submit'
449 self.xmpp['xep_0060'].publish(
450 'pubsub.example.com',
451 'somenode',
452 id='ID42',
453 payload=payload,
454 options=options,
455 block=False)
456 self.send("""
457 <iq type="set" id="1" to="pubsub.example.com">
458 <pubsub xmlns="http://jabber.org/protocol/pubsub">
459 <publish node="somenode">
460 <item id="ID42">
461 <entry xmlns="http://www.w3.org/2005/Atom">
462 <title>Test</title>
463 </entry>
464 </item>
465 </publish>
466 <publish-options>
467 <x xmlns="jabber:x:data" type="submit">
468 <field var="FORM_TYPE">
469 <value>http://jabber.org/protocol/pubsub#publish-options</value>
470 </field>
471 <field var="pubsub#access_model">
472 <value>presence</value>
473 </field>
474 </x>
475 </publish-options>
476 </pubsub>
477 </iq>
478 """, use_values=False)
480 def testRetract(self):
481 """Test deleting an item."""
482 self.xmpp['xep_0060'].retract(
483 'pubsub.example.com',
484 'somenode',
485 'ID1',
486 notify=True,
487 block=False)
488 self.send("""
489 <iq type="set" id="1" to="pubsub.example.com">
490 <pubsub xmlns="http://jabber.org/protocol/pubsub">
491 <retract node="somenode" notify="true">
492 <item id="ID1" />
493 </retract>
494 </pubsub>
495 </iq>
496 """)
498 def testRetract(self):
499 """Test deleting an item."""
500 self.xmpp['xep_0060'].retract(
501 'pubsub.example.com',
502 'somenode',
503 'ID1',
504 block=False)
505 self.send("""
506 <iq type="set" id="1" to="pubsub.example.com">
507 <pubsub xmlns="http://jabber.org/protocol/pubsub">
508 <retract node="somenode">
509 <item id="ID1" />
510 </retract>
511 </pubsub>
512 </iq>
513 """)
515 def testPurge(self):
516 """Test removing all items from a node."""
517 self.xmpp['xep_0060'].purge(
518 'pubsub.example.com',
519 'somenode',
520 block=False)
521 self.send("""
522 <iq type="set" id="1" to="pubsub.example.com">
523 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
524 <purge node="somenode" />
525 </pubsub>
526 </iq>
527 """)
529 def testGetItem(self):
530 """Test retrieving a single item."""
531 self.xmpp['xep_0060'].get_item(
532 'pubsub.example.com',
533 'somenode',
534 'id42',
535 block=False)
536 self.send("""
537 <iq type="get" id="1" to="pubsub.example.com">
538 <pubsub xmlns="http://jabber.org/protocol/pubsub">
539 <items node="somenode">
540 <item id="id42" />
541 </items>
542 </pubsub>
543 </iq>
544 """)
546 def testGetLatestItems(self):
547 """Test retrieving the most recent N items."""
548 self.xmpp['xep_0060'].get_items(
549 'pubsub.example.com',
550 'somenode',
551 max_items=3,
552 block=False)
553 self.send("""
554 <iq type="get" id="1" to="pubsub.example.com">
555 <pubsub xmlns="http://jabber.org/protocol/pubsub">
556 <items node="somenode" max_items="3" />
557 </pubsub>
558 </iq>
559 """)
561 def testGetAllItems(self):
562 """Test retrieving all items."""
563 self.xmpp['xep_0060'].get_items(
564 'pubsub.example.com',
565 'somenode',
566 block=False)
567 self.send("""
568 <iq type="get" id="1" to="pubsub.example.com">
569 <pubsub xmlns="http://jabber.org/protocol/pubsub">
570 <items node="somenode" />
571 </pubsub>
572 </iq>
573 """)
575 def testGetSpecificItems(self):
576 """Test retrieving a specific set of items."""
577 self.xmpp['xep_0060'].get_items(
578 'pubsub.example.com',
579 'somenode',
580 item_ids=['A', 'B', 'C'],
581 block=False)
582 self.send("""
583 <iq type="get" id="1" to="pubsub.example.com">
584 <pubsub xmlns="http://jabber.org/protocol/pubsub">
585 <items node="somenode">
586 <item id="A" />
587 <item id="B" />
588 <item id="C" />
589 </items>
590 </pubsub>
591 </iq>
592 """)
594 def testGetSubscriptionGlobalDefaultOptions(self):
595 """Test getting the subscription options for a node/JID."""
596 self.xmpp['xep_0060'].get_subscription_options(
597 'pubsub.example.com',
598 block=False)
599 self.send("""
600 <iq type="get" id="1" to="pubsub.example.com">
601 <pubsub xmlns="http://jabber.org/protocol/pubsub">
602 <default />
603 </pubsub>
604 </iq>
605 """, use_values=False)
607 def testGetSubscriptionNodeDefaultOptions(self):
608 """Test getting the subscription options for a node/JID."""
609 self.xmpp['xep_0060'].get_subscription_options(
610 'pubsub.example.com',
611 node='somenode',
612 block=False)
613 self.send("""
614 <iq type="get" id="1" to="pubsub.example.com">
615 <pubsub xmlns="http://jabber.org/protocol/pubsub">
616 <default node="somenode" />
617 </pubsub>
618 </iq>
619 """, use_values=False)
621 def testGetSubscriptionOptions(self):
622 """Test getting the subscription options for a node/JID."""
623 self.xmpp['xep_0060'].get_subscription_options(
624 'pubsub.example.com',
625 'somenode',
626 'tester@localhost',
627 block=False)
628 self.send("""
629 <iq type="get" id="1" to="pubsub.example.com">
630 <pubsub xmlns="http://jabber.org/protocol/pubsub">
631 <options node="somenode" jid="tester@localhost" />
632 </pubsub>
633 </iq>
634 """, use_values=False)
636 def testSetSubscriptionOptions(self):
637 """Test setting the subscription options for a node/JID."""
638 opts = self.xmpp['xep_0004'].make_form()
639 opts.add_field(
640 var='FORM_TYPE',
641 value='http://jabber.org/protocol/pubsub#subscribe_options',
642 ftype='hidden')
643 opts.add_field(
644 var='pubsub#digest',
645 value=False,
646 ftype='boolean')
647 opts['type'] = 'submit'
649 self.xmpp['xep_0060'].set_subscription_options(
650 'pubsub.example.com',
651 'somenode',
652 'tester@localhost',
653 opts,
654 block=False)
655 self.send("""
656 <iq type="get" id="1" to="pubsub.example.com">
657 <pubsub xmlns="http://jabber.org/protocol/pubsub">
658 <options node="somenode" jid="tester@localhost">
659 <x xmlns="jabber:x:data" type="submit">
660 <field var="FORM_TYPE">
661 <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
662 </field>
663 <field var="pubsub#digest">
664 <value>0</value>
665 </field>
666 </x>
667 </options>
668 </pubsub>
669 </iq>
670 """)
672 def testGetNodeSubscriptions(self):
673 """Test retrieving all subscriptions for a node."""
674 self.xmpp['xep_0060'].get_node_subscriptions(
675 'pubsub.example.com',
676 'somenode',
677 block=False)
678 self.send("""
679 <iq type="get" id="1" to="pubsub.example.com">
680 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
681 <subscriptions node="somenode" />
682 </pubsub>
683 </iq>
684 """)
686 def testGetSubscriptions(self):
687 """Test retrieving a users's subscriptions."""
688 self.xmpp['xep_0060'].get_subscriptions(
689 'pubsub.example.com',
690 block=False)
691 self.send("""
692 <iq type="get" id="1" to="pubsub.example.com">
693 <pubsub xmlns="http://jabber.org/protocol/pubsub">
694 <subscriptions />
695 </pubsub>
696 </iq>
697 """)
699 def testGetSubscriptionsForNode(self):
700 """Test retrieving a users's subscriptions for a given node."""
701 self.xmpp['xep_0060'].get_subscriptions(
702 'pubsub.example.com',
703 node='somenode',
704 block=False)
705 self.send("""
706 <iq type="get" id="1" to="pubsub.example.com">
707 <pubsub xmlns="http://jabber.org/protocol/pubsub">
708 <subscriptions node="somenode" />
709 </pubsub>
710 </iq>
711 """)
713 def testGetAffiliations(self):
714 """Test retrieving a users's affiliations."""
715 self.xmpp['xep_0060'].get_affiliations(
716 'pubsub.example.com',
717 block=False)
718 self.send("""
719 <iq type="get" id="1" to="pubsub.example.com">
720 <pubsub xmlns="http://jabber.org/protocol/pubsub">
721 <affiliations />
722 </pubsub>
723 </iq>
724 """)
726 def testGetAffiliatinssForNode(self):
727 """Test retrieving a users's affiliations for a given node."""
728 self.xmpp['xep_0060'].get_affiliations(
729 'pubsub.example.com',
730 node='somenode',
731 block=False)
732 self.send("""
733 <iq type="get" id="1" to="pubsub.example.com">
734 <pubsub xmlns="http://jabber.org/protocol/pubsub">
735 <affiliations node="somenode" />
736 </pubsub>
737 </iq>
738 """)
740 def testGetNodeAffiliations(self):
741 """Test getting the affiliations for a node."""
742 self.xmpp['xep_0060'].get_node_affiliations(
743 'pubsub.example.com',
744 'somenode',
745 block=False)
746 self.send("""
747 <iq type="get" id="1" to="pubsub.example.com">
748 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
749 <affiliations node="somenode" />
750 </pubsub>
751 </iq>
752 """)
754 def testModifySubscriptions(self):
755 """Test owner modifying node subscriptions."""
756 self.xmpp['xep_0060'].modify_subscriptions(
757 'pubsub.example.com',
758 'somenode',
759 subscriptions=[('user@example.com', 'subscribed'),
760 ('foo@example.net', 'none')],
761 block=False)
762 self.send("""
763 <iq type="set" id="1" to="pubsub.example.com">
764 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
765 <subscriptions node="somenode">
766 <subscription jid="user@example.com" subscription="subscribed" />
767 <subscription jid="foo@example.net" subscription="none" />
768 </subscriptions>
769 </pubsub>
770 </iq>
771 """)
773 def testModifyAffiliations(self):
774 """Test owner modifying node affiliations."""
775 self.xmpp['xep_0060'].modify_affiliations(
776 'pubsub.example.com',
777 'somenode',
778 affiliations=[('user@example.com', 'publisher'),
779 ('foo@example.net', 'none')],
780 block=False)
781 self.send("""
782 <iq type="set" id="1" to="pubsub.example.com">
783 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
784 <affiliations node="somenode">
785 <affiliation jid="user@example.com" affiliation="publisher" />
786 <affiliation jid="foo@example.net" affiliation="none" />
787 </affiliations>
788 </pubsub>
789 </iq>
790 """)
793 suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub)