diff options
author | Lance Stout <lancestout@gmail.com> | 2010-07-19 13:58:53 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-07-19 13:58:53 -0400 |
commit | d5e42ac0e7282500583bf17f21eb2f944600ce76 (patch) | |
tree | 28decf6b57e7072748f59c05d84de0f1fdf4101d /tests | |
parent | e6bec8681e07ced607db1fbcbc5e356c3936f1d1 (diff) | |
download | slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.gz slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.bz2 slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.tar.xz slixmpp-d5e42ac0e7282500583bf17f21eb2f944600ce76.zip |
Condensed all of the stanzaPlugin functions into a single registerStanzaPlugin function.
Updated plugins and tests to use new function.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sleektest.py | 10 | ||||
-rw-r--r-- | tests/test_addresses.py | 2 | ||||
-rw-r--r-- | tests/test_chatstates.py | 10 | ||||
-rw-r--r-- | tests/test_disco.py | 4 | ||||
-rw-r--r-- | tests/test_forms.py | 6 | ||||
-rw-r--r-- | tests/test_gmail.py | 6 | ||||
-rw-r--r-- | tests/test_messagestanzas.py | 4 |
7 files changed, 18 insertions, 24 deletions
diff --git a/tests/sleektest.py b/tests/sleektest.py index eef3b900..3c270ebd 100644 --- a/tests/sleektest.py +++ b/tests/sleektest.py @@ -17,6 +17,8 @@ from sleekxmpp import ClientXMPP from sleekxmpp import Message, Iq from sleekxmpp.stanza.presence import Presence from sleekxmpp.xmlstream.matcher.stanzapath import StanzaPath +from sleekxmpp.xmlstream.stanzabase import registerStanzaPlugin + class TestSocket(object): @@ -88,14 +90,6 @@ class SleekTest(unittest.TestCase): methods for comparing message, iq, and presence stanzas. """ - def stanzaPlugin(self, stanza, plugin): - """ - Associate a stanza object as a plugin for another stanza. - """ - tag = "{%s}%s" % (plugin.namespace, plugin.name) - stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin - stanza.plugin_tag_map[tag] = plugin - # ------------------------------------------------------------------ # Shortcut methods for creating stanza objects diff --git a/tests/test_addresses.py b/tests/test_addresses.py index 2718bb19..63d11003 100644 --- a/tests/test_addresses.py +++ b/tests/test_addresses.py @@ -5,7 +5,7 @@ import sleekxmpp.plugins.xep_0033 as xep_0033 class TestAddresses(SleekTest): def setUp(self): - self.stanzaPlugin(Message, xep_0033.Addresses) + registerStanzaPlugin(Message, xep_0033.Addresses) def testAddAddress(self): """Testing adding extended stanza address.""" diff --git a/tests/test_chatstates.py b/tests/test_chatstates.py index 1e585be4..bcacb9e5 100644 --- a/tests/test_chatstates.py +++ b/tests/test_chatstates.py @@ -4,11 +4,11 @@ import sleekxmpp.plugins.xep_0085 as xep_0085 class TestChatStates(SleekTest): def setUp(self): - self.stanzaPlugin(Message, xep_0085.Active) - self.stanzaPlugin(Message, xep_0085.Composing) - self.stanzaPlugin(Message, xep_0085.Gone) - self.stanzaPlugin(Message, xep_0085.Inactive) - self.stanzaPlugin(Message, xep_0085.Paused) + registerStanzaPlugin(Message, xep_0085.Active) + registerStanzaPlugin(Message, xep_0085.Composing) + registerStanzaPlugin(Message, xep_0085.Gone) + registerStanzaPlugin(Message, xep_0085.Inactive) + registerStanzaPlugin(Message, xep_0085.Paused) def testCreateChatState(self): """Testing creating chat states.""" diff --git a/tests/test_disco.py b/tests/test_disco.py index 6daad13e..96a12e2a 100644 --- a/tests/test_disco.py +++ b/tests/test_disco.py @@ -5,8 +5,8 @@ import sleekxmpp.plugins.xep_0030 as xep_0030 class TestDisco(SleekTest): def setUp(self): - self.stanzaPlugin(Iq, xep_0030.DiscoInfo) - self.stanzaPlugin(Iq, xep_0030.DiscoItems) + registerStanzaPlugin(Iq, xep_0030.DiscoInfo) + registerStanzaPlugin(Iq, xep_0030.DiscoItems) def testCreateInfoQueryNoNode(self): """Testing disco#info query with no node.""" diff --git a/tests/test_forms.py b/tests/test_forms.py index 981d8870..16160249 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -5,9 +5,9 @@ import sleekxmpp.plugins.alt_0004 as xep_0004 class TestDataForms(SleekTest): def setUp(self): - self.stanzaPlugin(Message, xep_0004.Form) - self.stanzaPlugin(xep_0004.Form, xep_0004.FormField) - self.stanzaPlugin(xep_0004.FormField, xep_0004.FieldOption) + registerStanzaPlugin(Message, xep_0004.Form) + registerStanzaPlugin(xep_0004.Form, xep_0004.FormField) + registerStanzaPlugin(xep_0004.FormField, xep_0004.FieldOption) def testMultipleInstructions(self): """Testing using multiple instructions elements in a data form.""" diff --git a/tests/test_gmail.py b/tests/test_gmail.py index 199b76ae..b2e70d21 100644 --- a/tests/test_gmail.py +++ b/tests/test_gmail.py @@ -5,9 +5,9 @@ import sleekxmpp.plugins.gmail_notify as gmail class TestGmail(SleekTest): def setUp(self): - self.stanzaPlugin(Iq, gmail.GmailQuery) - self.stanzaPlugin(Iq, gmail.MailBox) - self.stanzaPlugin(Iq, gmail.NewMail) + registerStanzaPlugin(Iq, gmail.GmailQuery) + registerStanzaPlugin(Iq, gmail.MailBox) + registerStanzaPlugin(Iq, gmail.NewMail) def testCreateQuery(self): """Testing querying Gmail for emails.""" diff --git a/tests/test_messagestanzas.py b/tests/test_messagestanzas.py index 08488ce3..026a5782 100644 --- a/tests/test_messagestanzas.py +++ b/tests/test_messagestanzas.py @@ -5,9 +5,9 @@ class testmessagestanzas(unittest.TestCase): def setUp(self): import sleekxmpp.stanza.message as m - from sleekxmpp.basexmpp import stanzaPlugin + from sleekxmpp.basexmpp import registerStanzaPlugin from sleekxmpp.stanza.htmlim import HTMLIM - stanzaPlugin(m.Message, HTMLIM) + registerStanzaPlugin(m.Message, HTMLIM) self.m = m def testGroupchatReplyRegression(self): |