summaryrefslogtreecommitdiff
path: root/tests/test_addresses.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-08-05 20:23:07 -0400
committerLance Stout <lancestout@gmail.com>2010-08-05 20:23:07 -0400
commit58f77d898f82ab108fa17d562a32c68d3ea35306 (patch)
tree441530e8518726fb55b2056340fa5ea03bec7638 /tests/test_addresses.py
parentc54466596f3dcc7a35a41c49fff0d057d4a8ed8f (diff)
downloadslixmpp-58f77d898f82ab108fa17d562a32c68d3ea35306.tar.gz
slixmpp-58f77d898f82ab108fa17d562a32c68d3ea35306.tar.bz2
slixmpp-58f77d898f82ab108fa17d562a32c68d3ea35306.tar.xz
slixmpp-58f77d898f82ab108fa17d562a32c68d3ea35306.zip
Updated tests to use a relative import for SleekTest to please Python3.
Fixed some tabs/spaces issues.
Diffstat (limited to 'tests/test_addresses.py')
-rw-r--r--tests/test_addresses.py203
1 files changed, 102 insertions, 101 deletions
diff --git a/tests/test_addresses.py b/tests/test_addresses.py
index 63d11003..450e1362 100644
--- a/tests/test_addresses.py
+++ b/tests/test_addresses.py
@@ -1,110 +1,111 @@
-from sleektest import *
+from . sleektest import *
import sleekxmpp.plugins.xep_0033 as xep_0033
class TestAddresses(SleekTest):
- def setUp(self):
- registerStanzaPlugin(Message, xep_0033.Addresses)
-
- def testAddAddress(self):
- """Testing adding extended stanza address."""
- msg = self.Message()
- msg['addresses'].addAddress(atype='to', jid='to@header1.org')
- self.checkMessage(msg, """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address jid="to@header1.org" type="to" />
- </addresses>
- </message>
- """)
-
- msg = self.Message()
- msg['addresses'].addAddress(atype='replyto',
- jid='replyto@header1.org',
- desc='Reply address')
- self.checkMessage(msg, """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address jid="replyto@header1.org" type="replyto" desc="Reply address" />
- </addresses>
- </message>
- """)
-
- def testAddAddresses(self):
- """Testing adding multiple extended stanza addresses."""
-
- xmlstring = """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address jid="replyto@header1.org" type="replyto" desc="Reply address" />
- <address jid="cc@header2.org" type="cc" />
- <address jid="bcc@header2.org" type="bcc" />
- </addresses>
- </message>
- """
-
- msg = self.Message()
- msg['addresses'].setAddresses([{'type':'replyto',
- 'jid':'replyto@header1.org',
- 'desc':'Reply address'},
- {'type':'cc',
- 'jid':'cc@header2.org'},
- {'type':'bcc',
- 'jid':'bcc@header2.org'}])
- self.checkMessage(msg, xmlstring)
-
- msg = self.Message()
- msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
+ def setUp(self):
+ registerStanzaPlugin(Message, xep_0033.Addresses)
+
+ def testAddAddress(self):
+ """Testing adding extended stanza address."""
+ msg = self.Message()
+ msg['addresses'].addAddress(atype='to', jid='to@header1.org')
+ self.checkMessage(msg, """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address jid="to@header1.org" type="to" />
+ </addresses>
+ </message>
+ """)
+
+ msg = self.Message()
+ msg['addresses'].addAddress(atype='replyto',
+ jid='replyto@header1.org',
+ desc='Reply address')
+ self.checkMessage(msg, """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address jid="replyto@header1.org" type="replyto" desc="Reply address" />
+ </addresses>
+ </message>
+ """)
+
+ def testAddAddresses(self):
+ """Testing adding multiple extended stanza addresses."""
+
+ xmlstring = """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address jid="replyto@header1.org" type="replyto" desc="Reply address" />
+ <address jid="cc@header2.org" type="cc" />
+ <address jid="bcc@header2.org" type="bcc" />
+ </addresses>
+ </message>
+ """
+
+ msg = self.Message()
+ msg['addresses'].setAddresses([
+ {'type':'replyto',
+ 'jid':'replyto@header1.org',
+ 'desc':'Reply address'},
+ {'type':'cc',
+ 'jid':'cc@header2.org'},
+ {'type':'bcc',
+ 'jid':'bcc@header2.org'}])
+ self.checkMessage(msg, xmlstring)
+
+ msg = self.Message()
+ msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
'desc':'Reply address'}]
- msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
- msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
- self.checkMessage(msg, xmlstring)
-
- def testAddURI(self):
- """Testing adding URI attribute to extended stanza address."""
-
- msg = self.Message()
- addr = msg['addresses'].addAddress(atype='to',
- jid='to@header1.org',
- node='foo')
- self.checkMessage(msg, """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address node="foo" jid="to@header1.org" type="to" />
- </addresses>
- </message>
- """)
-
- addr['uri'] = 'mailto:to@header2.org'
- self.checkMessage(msg, """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address type="to" uri="mailto:to@header2.org" />
- </addresses>
- </message>
- """)
-
- def testDelivered(self):
- """Testing delivered attribute of extended stanza addresses."""
-
- xmlstring = """
- <message>
- <addresses xmlns="http://jabber.org/protocol/address">
- <address %s jid="to@header1.org" type="to" />
- </addresses>
- </message>
- """
-
- msg = self.Message()
- addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
- self.checkMessage(msg, xmlstring % '')
-
- addr['delivered'] = True
- self.checkMessage(msg, xmlstring % 'delivered="true"')
-
- addr['delivered'] = False
- self.checkMessage(msg, xmlstring % '')
+ msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
+ msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
+ self.checkMessage(msg, xmlstring)
+
+ def testAddURI(self):
+ """Testing adding URI attribute to extended stanza address."""
+
+ msg = self.Message()
+ addr = msg['addresses'].addAddress(atype='to',
+ jid='to@header1.org',
+ node='foo')
+ self.checkMessage(msg, """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address node="foo" jid="to@header1.org" type="to" />
+ </addresses>
+ </message>
+ """)
+
+ addr['uri'] = 'mailto:to@header2.org'
+ self.checkMessage(msg, """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address type="to" uri="mailto:to@header2.org" />
+ </addresses>
+ </message>
+ """)
+
+ def testDelivered(self):
+ """Testing delivered attribute of extended stanza addresses."""
+
+ xmlstring = """
+ <message>
+ <addresses xmlns="http://jabber.org/protocol/address">
+ <address %s jid="to@header1.org" type="to" />
+ </addresses>
+ </message>
+ """
+
+ msg = self.Message()
+ addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
+ self.checkMessage(msg, xmlstring % '')
+
+ addr['delivered'] = True
+ self.checkMessage(msg, xmlstring % 'delivered="true"')
+
+ addr['delivered'] = False
+ self.checkMessage(msg, xmlstring % '')
suite = unittest.TestLoader().loadTestsFromTestCase(TestAddresses)