mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Updated tests to use a relative import for SleekTest to please Python3.
Fixed some tabs/spaces issues.
This commit is contained in:
parent
c54466596f
commit
58f77d898f
13 changed files with 337 additions and 336 deletions
|
@ -1,110 +1,111 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0033 as xep_0033
|
import sleekxmpp.plugins.xep_0033 as xep_0033
|
||||||
|
|
||||||
|
|
||||||
class TestAddresses(SleekTest):
|
class TestAddresses(SleekTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
registerStanzaPlugin(Message, xep_0033.Addresses)
|
registerStanzaPlugin(Message, xep_0033.Addresses)
|
||||||
|
|
||||||
def testAddAddress(self):
|
def testAddAddress(self):
|
||||||
"""Testing adding extended stanza address."""
|
"""Testing adding extended stanza address."""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['addresses'].addAddress(atype='to', jid='to@header1.org')
|
msg['addresses'].addAddress(atype='to', jid='to@header1.org')
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address jid="to@header1.org" type="to" />
|
<address jid="to@header1.org" type="to" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['addresses'].addAddress(atype='replyto',
|
msg['addresses'].addAddress(atype='replyto',
|
||||||
jid='replyto@header1.org',
|
jid='replyto@header1.org',
|
||||||
desc='Reply address')
|
desc='Reply address')
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
|
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
def testAddAddresses(self):
|
def testAddAddresses(self):
|
||||||
"""Testing adding multiple extended stanza addresses."""
|
"""Testing adding multiple extended stanza addresses."""
|
||||||
|
|
||||||
xmlstring = """
|
xmlstring = """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
|
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
|
||||||
<address jid="cc@header2.org" type="cc" />
|
<address jid="cc@header2.org" type="cc" />
|
||||||
<address jid="bcc@header2.org" type="bcc" />
|
<address jid="bcc@header2.org" type="bcc" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['addresses'].setAddresses([{'type':'replyto',
|
msg['addresses'].setAddresses([
|
||||||
'jid':'replyto@header1.org',
|
{'type':'replyto',
|
||||||
'desc':'Reply address'},
|
'jid':'replyto@header1.org',
|
||||||
{'type':'cc',
|
'desc':'Reply address'},
|
||||||
'jid':'cc@header2.org'},
|
{'type':'cc',
|
||||||
{'type':'bcc',
|
'jid':'cc@header2.org'},
|
||||||
'jid':'bcc@header2.org'}])
|
{'type':'bcc',
|
||||||
self.checkMessage(msg, xmlstring)
|
'jid':'bcc@header2.org'}])
|
||||||
|
self.checkMessage(msg, xmlstring)
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
|
msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
|
||||||
'desc':'Reply address'}]
|
'desc':'Reply address'}]
|
||||||
msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
|
msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
|
||||||
msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
|
msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
|
||||||
self.checkMessage(msg, xmlstring)
|
self.checkMessage(msg, xmlstring)
|
||||||
|
|
||||||
def testAddURI(self):
|
def testAddURI(self):
|
||||||
"""Testing adding URI attribute to extended stanza address."""
|
"""Testing adding URI attribute to extended stanza address."""
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
addr = msg['addresses'].addAddress(atype='to',
|
addr = msg['addresses'].addAddress(atype='to',
|
||||||
jid='to@header1.org',
|
jid='to@header1.org',
|
||||||
node='foo')
|
node='foo')
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address node="foo" jid="to@header1.org" type="to" />
|
<address node="foo" jid="to@header1.org" type="to" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
addr['uri'] = 'mailto:to@header2.org'
|
addr['uri'] = 'mailto:to@header2.org'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address type="to" uri="mailto:to@header2.org" />
|
<address type="to" uri="mailto:to@header2.org" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
def testDelivered(self):
|
def testDelivered(self):
|
||||||
"""Testing delivered attribute of extended stanza addresses."""
|
"""Testing delivered attribute of extended stanza addresses."""
|
||||||
|
|
||||||
xmlstring = """
|
xmlstring = """
|
||||||
<message>
|
<message>
|
||||||
<addresses xmlns="http://jabber.org/protocol/address">
|
<addresses xmlns="http://jabber.org/protocol/address">
|
||||||
<address %s jid="to@header1.org" type="to" />
|
<address %s jid="to@header1.org" type="to" />
|
||||||
</addresses>
|
</addresses>
|
||||||
</message>
|
</message>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
|
addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
|
||||||
self.checkMessage(msg, xmlstring % '')
|
self.checkMessage(msg, xmlstring % '')
|
||||||
|
|
||||||
addr['delivered'] = True
|
addr['delivered'] = True
|
||||||
self.checkMessage(msg, xmlstring % 'delivered="true"')
|
self.checkMessage(msg, xmlstring % 'delivered="true"')
|
||||||
|
|
||||||
addr['delivered'] = False
|
addr['delivered'] = False
|
||||||
self.checkMessage(msg, xmlstring % '')
|
self.checkMessage(msg, xmlstring % '')
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestAddresses)
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestAddresses)
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0085 as xep_0085
|
import sleekxmpp.plugins.xep_0085 as xep_0085
|
||||||
|
|
||||||
class TestChatStates(SleekTest):
|
class TestChatStates(SleekTest):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
registerStanzaPlugin(Message, xep_0085.Active)
|
registerStanzaPlugin(Message, xep_0085.Active)
|
||||||
registerStanzaPlugin(Message, xep_0085.Composing)
|
registerStanzaPlugin(Message, xep_0085.Composing)
|
||||||
registerStanzaPlugin(Message, xep_0085.Gone)
|
registerStanzaPlugin(Message, xep_0085.Gone)
|
||||||
registerStanzaPlugin(Message, xep_0085.Inactive)
|
registerStanzaPlugin(Message, xep_0085.Inactive)
|
||||||
registerStanzaPlugin(Message, xep_0085.Paused)
|
registerStanzaPlugin(Message, xep_0085.Paused)
|
||||||
|
|
||||||
def testCreateChatState(self):
|
def testCreateChatState(self):
|
||||||
"""Testing creating chat states."""
|
"""Testing creating chat states."""
|
||||||
|
|
||||||
xmlstring = """
|
xmlstring = """
|
||||||
<message>
|
<message>
|
||||||
<%s xmlns="http://jabber.org/protocol/chatstates" />
|
<%s xmlns="http://jabber.org/protocol/chatstates" />
|
||||||
</message>
|
</message>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['chat_state'].active()
|
msg['chat_state'].active()
|
||||||
self.checkMessage(msg, xmlstring % 'active',
|
self.checkMessage(msg, xmlstring % 'active',
|
||||||
use_values=False)
|
use_values=False)
|
||||||
|
|
||||||
msg['chat_state'].composing()
|
msg['chat_state'].composing()
|
||||||
self.checkMessage(msg, xmlstring % 'composing',
|
self.checkMessage(msg, xmlstring % 'composing',
|
||||||
use_values=False)
|
use_values=False)
|
||||||
|
|
||||||
|
|
||||||
msg['chat_state'].gone()
|
msg['chat_state'].gone()
|
||||||
self.checkMessage(msg, xmlstring % 'gone',
|
self.checkMessage(msg, xmlstring % 'gone',
|
||||||
use_values=False)
|
use_values=False)
|
||||||
|
|
||||||
msg['chat_state'].inactive()
|
msg['chat_state'].inactive()
|
||||||
self.checkMessage(msg, xmlstring % 'inactive',
|
self.checkMessage(msg, xmlstring % 'inactive',
|
||||||
use_values=False)
|
use_values=False)
|
||||||
|
|
||||||
msg['chat_state'].paused()
|
msg['chat_state'].paused()
|
||||||
self.checkMessage(msg, xmlstring % 'paused',
|
self.checkMessage(msg, xmlstring % 'paused',
|
||||||
use_values=False)
|
use_values=False)
|
||||||
|
|
||||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0030 as xep_0030
|
import sleekxmpp.plugins.xep_0030 as xep_0030
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ class TestDisco(SleekTest):
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['id'] = "0"
|
iq['id'] = "0"
|
||||||
iq['disco_info']['node'] = 'foo'
|
iq['disco_info']['node'] = 'foo'
|
||||||
iq['disco_info'].addIdentity('conference', 'text', 'Chatroom')
|
iq['disco_info'].addIdentity('conference', 'text', 'Chatroom')
|
||||||
|
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
|
@ -76,8 +76,8 @@ class TestDisco(SleekTest):
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['id'] = "0"
|
iq['id'] = "0"
|
||||||
iq['disco_info']['node'] = 'foo'
|
iq['disco_info']['node'] = 'foo'
|
||||||
iq['disco_info'].addFeature('foo')
|
iq['disco_info'].addFeature('foo')
|
||||||
iq['disco_info'].addFeature('bar')
|
iq['disco_info'].addFeature('bar')
|
||||||
|
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
|
@ -93,9 +93,9 @@ class TestDisco(SleekTest):
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['id'] = "0"
|
iq['id'] = "0"
|
||||||
iq['disco_items']['node'] = 'foo'
|
iq['disco_items']['node'] = 'foo'
|
||||||
iq['disco_items'].addItem('user@localhost')
|
iq['disco_items'].addItem('user@localhost')
|
||||||
iq['disco_items'].addItem('user@localhost', 'foo')
|
iq['disco_items'].addItem('user@localhost', 'foo')
|
||||||
iq['disco_items'].addItem('user@localhost', 'bar', 'Testing')
|
iq['disco_items'].addItem('user@localhost', 'bar', 'Testing')
|
||||||
|
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
|
@ -109,68 +109,68 @@ class TestDisco(SleekTest):
|
||||||
|
|
||||||
def testAddRemoveIdentities(self):
|
def testAddRemoveIdentities(self):
|
||||||
"""Test adding and removing identities to disco#info stanza"""
|
"""Test adding and removing identities to disco#info stanza"""
|
||||||
ids = [('automation', 'commands', 'AdHoc'),
|
ids = [('automation', 'commands', 'AdHoc'),
|
||||||
('conference', 'text', 'ChatRoom')]
|
('conference', 'text', 'ChatRoom')]
|
||||||
|
|
||||||
info = xep_0030.DiscoInfo()
|
info = xep_0030.DiscoInfo()
|
||||||
info.addIdentity(*ids[0])
|
info.addIdentity(*ids[0])
|
||||||
self.failUnless(info.getIdentities() == [ids[0]])
|
self.failUnless(info.getIdentities() == [ids[0]])
|
||||||
|
|
||||||
info.delIdentity('automation', 'commands')
|
info.delIdentity('automation', 'commands')
|
||||||
self.failUnless(info.getIdentities() == [])
|
self.failUnless(info.getIdentities() == [])
|
||||||
|
|
||||||
info.setIdentities(ids)
|
info.setIdentities(ids)
|
||||||
self.failUnless(info.getIdentities() == ids)
|
self.failUnless(info.getIdentities() == ids)
|
||||||
|
|
||||||
info.delIdentity('automation', 'commands')
|
info.delIdentity('automation', 'commands')
|
||||||
self.failUnless(info.getIdentities() == [ids[1]])
|
self.failUnless(info.getIdentities() == [ids[1]])
|
||||||
|
|
||||||
info.delIdentities()
|
info.delIdentities()
|
||||||
self.failUnless(info.getIdentities() == [])
|
self.failUnless(info.getIdentities() == [])
|
||||||
|
|
||||||
def testAddRemoveFeatures(self):
|
def testAddRemoveFeatures(self):
|
||||||
"""Test adding and removing features to disco#info stanza"""
|
"""Test adding and removing features to disco#info stanza"""
|
||||||
features = ['foo', 'bar', 'baz']
|
features = ['foo', 'bar', 'baz']
|
||||||
|
|
||||||
info = xep_0030.DiscoInfo()
|
info = xep_0030.DiscoInfo()
|
||||||
info.addFeature(features[0])
|
info.addFeature(features[0])
|
||||||
self.failUnless(info.getFeatures() == [features[0]])
|
self.failUnless(info.getFeatures() == [features[0]])
|
||||||
|
|
||||||
info.delFeature('foo')
|
info.delFeature('foo')
|
||||||
self.failUnless(info.getFeatures() == [])
|
self.failUnless(info.getFeatures() == [])
|
||||||
|
|
||||||
info.setFeatures(features)
|
info.setFeatures(features)
|
||||||
self.failUnless(info.getFeatures() == features)
|
self.failUnless(info.getFeatures() == features)
|
||||||
|
|
||||||
info.delFeature('bar')
|
info.delFeature('bar')
|
||||||
self.failUnless(info.getFeatures() == ['foo', 'baz'])
|
self.failUnless(info.getFeatures() == ['foo', 'baz'])
|
||||||
|
|
||||||
info.delFeatures()
|
info.delFeatures()
|
||||||
self.failUnless(info.getFeatures() == [])
|
self.failUnless(info.getFeatures() == [])
|
||||||
|
|
||||||
def testAddRemoveItems(self):
|
def testAddRemoveItems(self):
|
||||||
"""Test adding and removing items to disco#items stanza"""
|
"""Test adding and removing items to disco#items stanza"""
|
||||||
items = [('user@localhost', None, None),
|
items = [('user@localhost', None, None),
|
||||||
('user@localhost', 'foo', None),
|
('user@localhost', 'foo', None),
|
||||||
('user@localhost', 'bar', 'Test')]
|
('user@localhost', 'bar', 'Test')]
|
||||||
|
|
||||||
info = xep_0030.DiscoItems()
|
info = xep_0030.DiscoItems()
|
||||||
self.failUnless(True, ""+str(items[0]))
|
self.failUnless(True, ""+str(items[0]))
|
||||||
|
|
||||||
info.addItem(*(items[0]))
|
info.addItem(*(items[0]))
|
||||||
self.failUnless(info.getItems() == [items[0]], info.getItems())
|
self.failUnless(info.getItems() == [items[0]], info.getItems())
|
||||||
|
|
||||||
info.delItem('user@localhost')
|
info.delItem('user@localhost')
|
||||||
self.failUnless(info.getItems() == [])
|
self.failUnless(info.getItems() == [])
|
||||||
|
|
||||||
info.setItems(items)
|
info.setItems(items)
|
||||||
self.failUnless(info.getItems() == items)
|
self.failUnless(info.getItems() == items)
|
||||||
|
|
||||||
info.delItem('user@localhost', 'foo')
|
info.delItem('user@localhost', 'foo')
|
||||||
self.failUnless(info.getItems() == [items[0], items[2]])
|
self.failUnless(info.getItems() == [items[0], items[2]])
|
||||||
|
|
||||||
info.delItems()
|
info.delItems()
|
||||||
self.failUnless(info.getItems() == [])
|
self.failUnless(info.getItems() == [])
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestDisco)
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestDisco)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
|
|
||||||
class TestErrorStanzas(SleekTest):
|
class TestErrorStanzas(SleekTest):
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class TestErrorStanzas(SleekTest):
|
||||||
|
|
||||||
def testCondition(self):
|
def testCondition(self):
|
||||||
"""Test modifying the error condition."""
|
"""Test modifying the error condition."""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['error']['condition'] = 'item-not-found'
|
msg['error']['condition'] = 'item-not-found'
|
||||||
|
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import sleekxmpp
|
import sleekxmpp
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
|
|
||||||
|
|
||||||
class TestEvents(SleekTest):
|
class TestEvents(SleekTest):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0004 as xep_0004
|
import sleekxmpp.plugins.xep_0004 as xep_0004
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.gmail_notify as gmail
|
import sleekxmpp.plugins.gmail_notify as gmail
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
from sleekxmpp.xmlstream.stanzabase import ET
|
from sleekxmpp.xmlstream.stanzabase import ET
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ class TestIqStanzas(SleekTest):
|
||||||
</iq>
|
</iq>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['id'] = 'test'
|
iq['id'] = 'test'
|
||||||
iq['error']['condition'] = 'feature-not-implemented'
|
iq['error']['condition'] = 'feature-not-implemented'
|
||||||
iq['error']['text'] = 'No handlers registered for this request.'
|
iq['error']['text'] = 'No handlers registered for this request.'
|
||||||
|
|
||||||
self.streamSendIq(iq, """
|
self.streamSendIq(iq, """
|
||||||
<iq id="test" type="error">
|
<iq id="test" type="error">
|
||||||
|
@ -72,21 +72,21 @@ class TestIqStanzas(SleekTest):
|
||||||
</iq>
|
</iq>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
self.failUnless(iq['query'] == 'query_ns2', "Query namespace doesn't match")
|
self.failUnless(iq['query'] == 'query_ns2', "Query namespace doesn't match")
|
||||||
|
|
||||||
del iq['query']
|
del iq['query']
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0" />
|
<iq id="0" />
|
||||||
""")
|
""")
|
||||||
|
|
||||||
def testReply(self):
|
def testReply(self):
|
||||||
"""Test setting proper result type in Iq replies."""
|
"""Test setting proper result type in Iq replies."""
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['to'] = 'user@localhost'
|
iq['to'] = 'user@localhost'
|
||||||
iq['type'] = 'get'
|
iq['type'] = 'get'
|
||||||
iq.reply()
|
iq.reply()
|
||||||
|
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0" type="result" />
|
<iq id="0" type="result" />
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
from sleekxmpp.xmlstream.jid import JID
|
from sleekxmpp.xmlstream.jid import JID
|
||||||
|
|
||||||
class TestJIDClass(SleekTest):
|
class TestJIDClass(SleekTest):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
from sleekxmpp.stanza.message import Message
|
from sleekxmpp.stanza.message import Message
|
||||||
from sleekxmpp.stanza.htmlim import HTMLIM
|
from sleekxmpp.stanza.htmlim import HTMLIM
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import sleekxmpp
|
import sleekxmpp
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
from sleekxmpp.stanza.presence import Presence
|
from sleekxmpp.stanza.presence import Presence
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0004 as xep_0004
|
import sleekxmpp.plugins.xep_0004 as xep_0004
|
||||||
import sleekxmpp.plugins.stanza_pubsub as pubsub
|
import sleekxmpp.plugins.stanza_pubsub as pubsub
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class TestPubsubStanzas(SleekTest):
|
||||||
sub2['subscription'] = 'subscribed'
|
sub2['subscription'] = 'subscribed'
|
||||||
iq['pubsub']['subscriptions'].append(sub1)
|
iq['pubsub']['subscriptions'].append(sub1)
|
||||||
iq['pubsub']['subscriptions'].append(sub2)
|
iq['pubsub']['subscriptions'].append(sub2)
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||||
<subscriptions>
|
<subscriptions>
|
||||||
|
@ -55,7 +55,7 @@ class TestPubsubStanzas(SleekTest):
|
||||||
iq['pubsub']['subscription']['node'] = 'testnode alsdkjfas'
|
iq['pubsub']['subscription']['node'] = 'testnode alsdkjfas'
|
||||||
iq['pubsub']['subscription']['jid'] = "fritzy@netflint.net/sleekxmpp"
|
iq['pubsub']['subscription']['jid'] = "fritzy@netflint.net/sleekxmpp"
|
||||||
iq['pubsub']['subscription']['subscription'] = 'unconfigured'
|
iq['pubsub']['subscription']['subscription'] = 'unconfigured'
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||||
<subscription node="testnode alsdkjfas" jid="fritzy@netflint.net/sleekxmpp" subscription="unconfigured">
|
<subscription node="testnode alsdkjfas" jid="fritzy@netflint.net/sleekxmpp" subscription="unconfigured">
|
||||||
|
@ -88,7 +88,7 @@ class TestPubsubStanzas(SleekTest):
|
||||||
item2['payload'] = payload2
|
item2['payload'] = payload2
|
||||||
iq['pubsub']['items'].append(item)
|
iq['pubsub']['items'].append(item)
|
||||||
iq['pubsub']['items'].append(item2)
|
iq['pubsub']['items'].append(item2)
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||||
<items>
|
<items>
|
||||||
|
@ -131,12 +131,12 @@ class TestPubsubStanzas(SleekTest):
|
||||||
|
|
||||||
def testState(self):
|
def testState(self):
|
||||||
"Testing iq/psstate stanzas"
|
"Testing iq/psstate stanzas"
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['psstate']['node']= 'mynode'
|
iq['psstate']['node']= 'mynode'
|
||||||
iq['psstate']['item']= 'myitem'
|
iq['psstate']['item']= 'myitem'
|
||||||
pl = ET.Element('{http://andyet.net/protocol/pubsubqueue}claimed')
|
pl = ET.Element('{http://andyet.net/protocol/pubsubqueue}claimed')
|
||||||
iq['psstate']['payload'] = pl
|
iq['psstate']['payload'] = pl
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<state xmlns="http://jabber.org/protocol/psstate" node="mynode" item="myitem">
|
<state xmlns="http://jabber.org/protocol/psstate" node="mynode" item="myitem">
|
||||||
<claimed xmlns="http://andyet.net/protocol/pubsubqueue" />
|
<claimed xmlns="http://andyet.net/protocol/pubsubqueue" />
|
||||||
|
@ -144,16 +144,16 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</iq>""")
|
</iq>""")
|
||||||
|
|
||||||
def testDefault(self):
|
def testDefault(self):
|
||||||
"Testing iq/pubsub_owner/default stanzas"
|
"Testing iq/pubsub_owner/default stanzas"
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['pubsub_owner']['default']
|
iq['pubsub_owner']['default']
|
||||||
iq['pubsub_owner']['default']['node'] = 'mynode'
|
iq['pubsub_owner']['default']['node'] = 'mynode'
|
||||||
iq['pubsub_owner']['default']['type'] = 'leaf'
|
iq['pubsub_owner']['default']['type'] = 'leaf'
|
||||||
iq['pubsub_owner']['default']['form'].addField('pubsub#title',
|
iq['pubsub_owner']['default']['form'].addField('pubsub#title',
|
||||||
ftype='text-single',
|
ftype='text-single',
|
||||||
value='This thing is awesome')
|
value='This thing is awesome')
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
||||||
<default node="mynode" type="leaf">
|
<default node="mynode" type="leaf">
|
||||||
<x xmlns="jabber:x:data" type="form">
|
<x xmlns="jabber:x:data" type="form">
|
||||||
|
@ -166,53 +166,53 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</iq>""", use_values=False)
|
</iq>""", use_values=False)
|
||||||
|
|
||||||
def testSubscribe(self):
|
def testSubscribe(self):
|
||||||
"Testing iq/pubsub/subscribe stanzas"
|
"testing iq/pubsub/subscribe stanzas"
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['pubsub']['subscribe']['options']
|
iq['pubsub']['subscribe']['options']
|
||||||
iq['pubsub']['subscribe']['node'] = 'cheese'
|
iq['pubsub']['subscribe']['node'] = 'cheese'
|
||||||
iq['pubsub']['subscribe']['jid'] = 'fritzy@netflint.net/sleekxmpp'
|
iq['pubsub']['subscribe']['jid'] = 'fritzy@netflint.net/sleekxmpp'
|
||||||
iq['pubsub']['subscribe']['options']['node'] = 'cheese'
|
iq['pubsub']['subscribe']['options']['node'] = 'cheese'
|
||||||
iq['pubsub']['subscribe']['options']['jid'] = 'fritzy@netflint.net/sleekxmpp'
|
iq['pubsub']['subscribe']['options']['jid'] = 'fritzy@netflint.net/sleekxmpp'
|
||||||
form = xep_0004.Form()
|
form = xep_0004.Form()
|
||||||
form.addField('pubsub#title', ftype='text-single', value='This thing is awesome')
|
form.addField('pubsub#title', ftype='text-single', value='this thing is awesome')
|
||||||
iq['pubsub']['subscribe']['options']['options'] = form
|
iq['pubsub']['subscribe']['options']['options'] = form
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub">
|
||||||
<subscribe node="cheese" jid="fritzy@netflint.net/sleekxmpp">
|
<subscribe node="cheese" jid="fritzy@netflint.net/sleekxmpp">
|
||||||
<options node="cheese" jid="fritzy@netflint.net/sleekxmpp">
|
<options node="cheese" jid="fritzy@netflint.net/sleekxmpp">
|
||||||
<x xmlns="jabber:x:data" type="form">
|
<x xmlns="jabber:x:data" type="form">
|
||||||
<field var="pubsub#title" type="text-single">
|
<field var="pubsub#title" type="text-single">
|
||||||
<value>This thing is awesome</value>
|
<value>this thing is awesome</value>
|
||||||
</field>
|
</field>
|
||||||
</x>
|
</x>
|
||||||
</options>
|
</options>
|
||||||
</subscribe>
|
</subscribe>
|
||||||
</pubsub>
|
</pubsub>
|
||||||
</iq>""", use_values=False)
|
</iq>""", use_values=False)
|
||||||
|
|
||||||
def testPublish(self):
|
def testPublish(self):
|
||||||
"Testing iq/pubsub/publish stanzas"
|
"Testing iq/pubsub/publish stanzas"
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['pubsub']['publish']['node'] = 'thingers'
|
iq['pubsub']['publish']['node'] = 'thingers'
|
||||||
payload = ET.fromstring("""
|
payload = ET.fromstring("""
|
||||||
<thinger xmlns="http://andyet.net/protocol/thinger" x="1" y='2'>
|
<thinger xmlns="http://andyet.net/protocol/thinger" x="1" y='2'>
|
||||||
<child1 />
|
<child1 />
|
||||||
<child2 normandy='cheese' foo='bar' />
|
<child2 normandy='cheese' foo='bar' />
|
||||||
</thinger>""")
|
</thinger>""")
|
||||||
payload2 = ET.fromstring("""
|
payload2 = ET.fromstring("""
|
||||||
<thinger2 xmlns="http://andyet.net/protocol/thinger2" x="12" y='22'>
|
<thinger2 xmlns="http://andyet.net/protocol/thinger2" x="12" y='22'>
|
||||||
<child12 />
|
<child12 />
|
||||||
<child22 normandy='cheese2' foo='bar2' />
|
<child22 normandy='cheese2' foo='bar2' />
|
||||||
</thinger2>""")
|
</thinger2>""")
|
||||||
item = pubsub.Item()
|
item = pubsub.Item()
|
||||||
item['id'] = 'asdf'
|
item['id'] = 'asdf'
|
||||||
item['payload'] = payload
|
item['payload'] = payload
|
||||||
item2 = pubsub.Item()
|
item2 = pubsub.Item()
|
||||||
item2['id'] = 'asdf2'
|
item2['id'] = 'asdf2'
|
||||||
item2['payload'] = payload2
|
item2['payload'] = payload2
|
||||||
iq['pubsub']['publish'].append(item)
|
iq['pubsub']['publish'].append(item)
|
||||||
iq['pubsub']['publish'].append(item2)
|
iq['pubsub']['publish'].append(item2)
|
||||||
|
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
|
@ -235,19 +235,19 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</iq>""")
|
</iq>""")
|
||||||
|
|
||||||
def testDelete(self):
|
def testDelete(self):
|
||||||
"Testing iq/pubsub_owner/delete stanzas"
|
"Testing iq/pubsub_owner/delete stanzas"
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['pubsub_owner']['delete']['node'] = 'thingers'
|
iq['pubsub_owner']['delete']['node'] = 'thingers'
|
||||||
self.checkIq(iq, """
|
self.checkIq(iq, """
|
||||||
<iq id="0">
|
<iq id="0">
|
||||||
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
||||||
<delete node="thingers" />
|
<delete node="thingers" />
|
||||||
</pubsub>
|
</pubsub>
|
||||||
</iq>""")
|
</iq>""")
|
||||||
|
|
||||||
def testCreateConfigGet(self):
|
def testCreateConfigGet(self):
|
||||||
"""Testing getting config from full create"""
|
"""Testing getting config from full create"""
|
||||||
iq = self.Iq()
|
iq = self.Iq()
|
||||||
iq['to'] = 'pubsub.asdf'
|
iq['to'] = 'pubsub.asdf'
|
||||||
iq['from'] = 'fritzy@asdf/87292ede-524d-4117-9076-d934ed3db8e7'
|
iq['from'] = 'fritzy@asdf/87292ede-524d-4117-9076-d934ed3db8e7'
|
||||||
iq['type'] = 'set'
|
iq['type'] = 'set'
|
||||||
|
@ -348,16 +348,16 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</iq>""")
|
</iq>""")
|
||||||
|
|
||||||
def testItemEvent(self):
|
def testItemEvent(self):
|
||||||
"""Testing message/pubsub_event/items/item"""
|
"""Testing message/pubsub_event/items/item"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
item = pubsub.EventItem()
|
item = pubsub.EventItem()
|
||||||
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
||||||
item['payload'] = pl
|
item['payload'] = pl
|
||||||
item['id'] = 'abc123'
|
item['id'] = 'abc123'
|
||||||
msg['pubsub_event']['items'].append(item)
|
msg['pubsub_event']['items'].append(item)
|
||||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||||
msg['type'] = 'normal'
|
msg['type'] = 'normal'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="normal">
|
<message type="normal">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<items node="cheese">
|
<items node="cheese">
|
||||||
|
@ -369,21 +369,21 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testItemsEvent(self):
|
def testItemsEvent(self):
|
||||||
"""Testing multiple message/pubsub_event/items/item"""
|
"""Testing multiple message/pubsub_event/items/item"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
item = pubsub.EventItem()
|
item = pubsub.EventItem()
|
||||||
item2 = pubsub.EventItem()
|
item2 = pubsub.EventItem()
|
||||||
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
||||||
pl2 = ET.Element('{http://netflint.net/protocol/test-other}test', {'total':'27', 'failed':'3'})
|
pl2 = ET.Element('{http://netflint.net/protocol/test-other}test', {'total':'27', 'failed':'3'})
|
||||||
item2['payload'] = pl2
|
item2['payload'] = pl2
|
||||||
item['payload'] = pl
|
item['payload'] = pl
|
||||||
item['id'] = 'abc123'
|
item['id'] = 'abc123'
|
||||||
item2['id'] = '123abc'
|
item2['id'] = '123abc'
|
||||||
msg['pubsub_event']['items'].append(item)
|
msg['pubsub_event']['items'].append(item)
|
||||||
msg['pubsub_event']['items'].append(item2)
|
msg['pubsub_event']['items'].append(item2)
|
||||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||||
msg['type'] = 'normal'
|
msg['type'] = 'normal'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="normal">
|
<message type="normal">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<items node="cheese">
|
<items node="cheese">
|
||||||
|
@ -398,24 +398,24 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testItemsEvent(self):
|
def testItemsEvent(self):
|
||||||
"""Testing message/pubsub_event/items/item & retract mix"""
|
"""Testing message/pubsub_event/items/item & retract mix"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
item = pubsub.EventItem()
|
item = pubsub.EventItem()
|
||||||
item2 = pubsub.EventItem()
|
item2 = pubsub.EventItem()
|
||||||
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
pl = ET.Element('{http://netflint.net/protocol/test}test', {'failed':'3', 'passed':'24'})
|
||||||
pl2 = ET.Element('{http://netflint.net/protocol/test-other}test', {'total':'27', 'failed':'3'})
|
pl2 = ET.Element('{http://netflint.net/protocol/test-other}test', {'total':'27', 'failed':'3'})
|
||||||
item2['payload'] = pl2
|
item2['payload'] = pl2
|
||||||
retract = pubsub.EventRetract()
|
retract = pubsub.EventRetract()
|
||||||
retract['id'] = 'aabbcc'
|
retract['id'] = 'aabbcc'
|
||||||
item['payload'] = pl
|
item['payload'] = pl
|
||||||
item['id'] = 'abc123'
|
item['id'] = 'abc123'
|
||||||
item2['id'] = '123abc'
|
item2['id'] = '123abc'
|
||||||
msg['pubsub_event']['items'].append(item)
|
msg['pubsub_event']['items'].append(item)
|
||||||
msg['pubsub_event']['items'].append(retract)
|
msg['pubsub_event']['items'].append(retract)
|
||||||
msg['pubsub_event']['items'].append(item2)
|
msg['pubsub_event']['items'].append(item2)
|
||||||
msg['pubsub_event']['items']['node'] = 'cheese'
|
msg['pubsub_event']['items']['node'] = 'cheese'
|
||||||
msg['type'] = 'normal'
|
msg['type'] = 'normal'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="normal">
|
<message type="normal">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<items node="cheese">
|
<items node="cheese">
|
||||||
|
@ -430,12 +430,12 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testCollectionAssociate(self):
|
def testCollectionAssociate(self):
|
||||||
"""Testing message/pubsub_event/collection/associate"""
|
"""Testing message/pubsub_event/collection/associate"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['pubsub_event']['collection']['associate']['node'] = 'cheese'
|
msg['pubsub_event']['collection']['associate']['node'] = 'cheese'
|
||||||
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
||||||
msg['type'] = 'headline'
|
msg['type'] = 'headline'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="headline">
|
<message type="headline">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<collection node="cheeseburger">
|
<collection node="cheeseburger">
|
||||||
|
@ -445,12 +445,12 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testCollectionDisassociate(self):
|
def testCollectionDisassociate(self):
|
||||||
"""Testing message/pubsub_event/collection/disassociate"""
|
"""Testing message/pubsub_event/collection/disassociate"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['pubsub_event']['collection']['disassociate']['node'] = 'cheese'
|
msg['pubsub_event']['collection']['disassociate']['node'] = 'cheese'
|
||||||
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
|
||||||
msg['type'] = 'headline'
|
msg['type'] = 'headline'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="headline">
|
<message type="headline">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<collection node="cheeseburger">
|
<collection node="cheeseburger">
|
||||||
|
@ -460,15 +460,15 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testEventConfiguration(self):
|
def testEventConfiguration(self):
|
||||||
"""Testing message/pubsub_event/configuration/config"""
|
"""Testing message/pubsub_event/configuration/config"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['pubsub_event']['configuration']['node'] = 'cheese'
|
msg['pubsub_event']['configuration']['node'] = 'cheese'
|
||||||
msg['pubsub_event']['configuration']['form'].addField('pubsub#title',
|
msg['pubsub_event']['configuration']['form'].addField('pubsub#title',
|
||||||
ftype='text-single',
|
ftype='text-single',
|
||||||
value='This thing is awesome')
|
value='This thing is awesome')
|
||||||
msg['type'] = 'headline'
|
msg['type'] = 'headline'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="headline">
|
<message type="headline">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<configuration node="cheese">
|
<configuration node="cheese">
|
||||||
<x xmlns="jabber:x:data" type="form">
|
<x xmlns="jabber:x:data" type="form">
|
||||||
|
@ -481,11 +481,11 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testEventPurge(self):
|
def testEventPurge(self):
|
||||||
"""Testing message/pubsub_event/purge"""
|
"""Testing message/pubsub_event/purge"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['pubsub_event']['purge']['node'] = 'pickles'
|
msg['pubsub_event']['purge']['node'] = 'pickles'
|
||||||
msg['type'] = 'headline'
|
msg['type'] = 'headline'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="headline">
|
<message type="headline">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<purge node="pickles" />
|
<purge node="pickles" />
|
||||||
|
@ -493,15 +493,15 @@ class TestPubsubStanzas(SleekTest):
|
||||||
</message>""")
|
</message>""")
|
||||||
|
|
||||||
def testEventSubscription(self):
|
def testEventSubscription(self):
|
||||||
"""Testing message/pubsub_event/subscription"""
|
"""Testing message/pubsub_event/subscription"""
|
||||||
msg = self.Message()
|
msg = self.Message()
|
||||||
msg['pubsub_event']['subscription']['node'] = 'pickles'
|
msg['pubsub_event']['subscription']['node'] = 'pickles'
|
||||||
msg['pubsub_event']['subscription']['jid'] = 'fritzy@netflint.net/test'
|
msg['pubsub_event']['subscription']['jid'] = 'fritzy@netflint.net/test'
|
||||||
msg['pubsub_event']['subscription']['subid'] = 'aabb1122'
|
msg['pubsub_event']['subscription']['subid'] = 'aabb1122'
|
||||||
msg['pubsub_event']['subscription']['subscription'] = 'subscribed'
|
msg['pubsub_event']['subscription']['subscription'] = 'subscribed'
|
||||||
msg['pubsub_event']['subscription']['expiry'] = 'presence'
|
msg['pubsub_event']['subscription']['expiry'] = 'presence'
|
||||||
msg['type'] = 'headline'
|
msg['type'] = 'headline'
|
||||||
self.checkMessage(msg, """
|
self.checkMessage(msg, """
|
||||||
<message type="headline">
|
<message type="headline">
|
||||||
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
<event xmlns="http://jabber.org/protocol/pubsub#event">
|
||||||
<subscription node="pickles" subid="aabb1122" jid="fritzy@netflint.net/test" subscription="subscribed" expiry="presence" />
|
<subscription node="pickles" subid="aabb1122" jid="fritzy@netflint.net/test" subscription="subscribed" expiry="presence" />
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sleektest import *
|
from . sleektest import *
|
||||||
import sleekxmpp.plugins.xep_0033 as xep_0033
|
import sleekxmpp.plugins.xep_0033 as xep_0033
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue