summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-17 21:38:22 -0400
committerLance Stout <lancestout@gmail.com>2010-10-17 22:04:42 -0400
commit4375ac7d8b9e62f34a4d3754a90b3538d5e978a3 (patch)
treec7da6dddc72ecd299f16d5dd82a4d81f8b0146fa /tests
parentfaec86b3be38756510fb3534c7615db75ecd53b7 (diff)
downloadslixmpp-4375ac7d8b9e62f34a4d3754a90b3538d5e978a3.tar.gz
slixmpp-4375ac7d8b9e62f34a4d3754a90b3538d5e978a3.tar.bz2
slixmpp-4375ac7d8b9e62f34a4d3754a90b3538d5e978a3.tar.xz
slixmpp-4375ac7d8b9e62f34a4d3754a90b3538d5e978a3.zip
Underscore names by default.
Stanza objects now accept the use of underscored names. The CamelCase versions are still available for backwards compatibility, but are discouraged. The property stanza.values now maps to the old getStanzaValues and setStanzaValues, in addition to _set_stanza_values and _get_stanza_values.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_stanza_element.py66
-rw-r--r--tests/test_stanza_gmail.py6
-rw-r--r--tests/test_stanza_message.py2
-rw-r--r--tests/test_stanza_presence.py2
-rw-r--r--tests/test_stanza_xep_0004.py6
-rw-r--r--tests/test_stanza_xep_0030.py4
-rw-r--r--tests/test_stanza_xep_0033.py2
-rw-r--r--tests/test_stanza_xep_0085.py10
8 files changed, 49 insertions, 49 deletions
diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py
index 2a774d6c..d361d6ff 100644
--- a/tests/test_stanza_element.py
+++ b/tests/test_stanza_element.py
@@ -55,7 +55,7 @@ class TestElementBase(SleekTest):
interfaces = set(('bar', 'baz'))
subitem = set((TestSubStanza,))
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
stanza = TestStanza()
stanza['bar'] = 'a'
@@ -102,8 +102,8 @@ class TestElementBase(SleekTest):
interfaces = set(('bar', 'baz'))
subitem = set((TestSubStanza,))
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
- registerStanzaPlugin(TestStanza, TestStanzaPlugin2)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin2)
stanza = TestStanza()
values = {'bar': 'a',
@@ -144,7 +144,7 @@ class TestElementBase(SleekTest):
interfaces = set(('fizz',))
TestStanza.subitem = (TestStanza,)
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
stanza = TestStanza()
substanza = TestStanza()
@@ -189,7 +189,7 @@ class TestElementBase(SleekTest):
plugin_attrib = "foobar"
interfaces = set(('foobar',))
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
stanza = TestStanza()
@@ -223,7 +223,7 @@ class TestElementBase(SleekTest):
plugin_attrib = "foobar"
interfaces = set(('foobar',))
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
stanza = TestStanza()
stanza['bar'] = 'a'
@@ -261,27 +261,27 @@ class TestElementBase(SleekTest):
<foo xmlns="foo" />
""")
- self.failUnless(stanza._getAttr('bar') == '',
+ self.failUnless(stanza._get_attr('bar') == '',
"Incorrect value returned for an unset XML attribute.")
- stanza._setAttr('bar', 'a')
- stanza._setAttr('baz', 'b')
+ stanza._set_attr('bar', 'a')
+ stanza._set_attr('baz', 'b')
self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" bar="a" baz="b" />
""")
- self.failUnless(stanza._getAttr('bar') == 'a',
+ self.failUnless(stanza._get_attr('bar') == 'a',
"Retrieved XML attribute value is incorrect.")
- stanza._setAttr('bar', None)
- stanza._delAttr('baz')
+ stanza._set_attr('bar', None)
+ stanza._del_attr('baz')
self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" />
""")
- self.failUnless(stanza._getAttr('bar', 'c') == 'c',
+ self.failUnless(stanza._get_attr('bar', 'c') == 'c',
"Incorrect default value returned for an unset XML attribute.")
def testGetSubText(self):
@@ -300,11 +300,11 @@ class TestElementBase(SleekTest):
self.xml.append(wrapper)
def getBar(self):
- return self._getSubText("wrapper/bar", default="not found")
+ return self._get_sub_text("wrapper/bar", default="not found")
stanza = TestStanza()
self.failUnless(stanza['bar'] == 'not found',
- "Default _getSubText value incorrect.")
+ "Default _get_sub_text value incorrect.")
stanza['bar'] = 'found'
self.check_stanza(TestStanza, stanza, """
@@ -315,7 +315,7 @@ class TestElementBase(SleekTest):
</foo>
""")
self.failUnless(stanza['bar'] == 'found',
- "_getSubText value incorrect: %s." % stanza['bar'])
+ "_get_sub_text value incorrect: %s." % stanza['bar'])
def testSubElement(self):
"""Test setting the contents of a sub element."""
@@ -326,16 +326,16 @@ class TestElementBase(SleekTest):
interfaces = set(('bar', 'baz'))
def setBaz(self, value):
- self._setSubText("wrapper/baz", text=value)
+ self._set_sub_text("wrapper/baz", text=value)
def getBaz(self):
- return self._getSubText("wrapper/baz")
+ return self._get_sub_text("wrapper/baz")
def setBar(self, value):
- self._setSubText("wrapper/bar", text=value)
+ self._set_sub_text("wrapper/bar", text=value)
def getBar(self):
- return self._getSubText("wrapper/bar")
+ return self._get_sub_text("wrapper/bar")
stanza = TestStanza()
stanza['bar'] = 'a'
@@ -348,7 +348,7 @@ class TestElementBase(SleekTest):
</wrapper>
</foo>
""")
- stanza._setSubText('wrapper/bar', text='', keep=True)
+ stanza._set_sub_text('wrapper/bar', text='', keep=True)
self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
@@ -359,7 +359,7 @@ class TestElementBase(SleekTest):
""", use_values=False)
stanza['bar'] = 'a'
- stanza._setSubText('wrapper/bar', text='')
+ stanza._set_sub_text('wrapper/bar', text='')
self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
@@ -377,22 +377,22 @@ class TestElementBase(SleekTest):
interfaces = set(('bar', 'baz'))
def setBar(self, value):
- self._setSubText("path/to/only/bar", value);
+ self._set_sub_text("path/to/only/bar", value);
def getBar(self):
- return self._getSubText("path/to/only/bar")
+ return self._get_sub_text("path/to/only/bar")
def delBar(self):
- self._delSub("path/to/only/bar")
+ self._del_sub("path/to/only/bar")
def setBaz(self, value):
- self._setSubText("path/to/just/baz", value);
+ self._set_sub_text("path/to/just/baz", value);
def getBaz(self):
- return self._getSubText("path/to/just/baz")
+ return self._get_sub_text("path/to/just/baz")
def delBaz(self):
- self._delSub("path/to/just/baz")
+ self._del_sub("path/to/just/baz")
stanza = TestStanza()
stanza['bar'] = 'a'
@@ -430,7 +430,7 @@ class TestElementBase(SleekTest):
stanza['bar'] = 'a'
stanza['baz'] = 'b'
- stanza._delSub('path/to/only/bar', all=True)
+ stanza._del_sub('path/to/only/bar', all=True)
self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
@@ -460,17 +460,17 @@ class TestElementBase(SleekTest):
subitem = (TestSubStanza,)
def setQux(self, value):
- self._setSubText('qux', text=value)
+ self._set_sub_text('qux', text=value)
def getQux(self):
- return self._getSubText('qux')
+ return self._get_sub_text('qux')
class TestStanzaPlugin(ElementBase):
name = "plugin"
namespace = "http://test/slash/bar"
interfaces = set(('attrib',))
- registerStanzaPlugin(TestStanza, TestStanzaPlugin)
+ register_stanza_plugin(TestStanza, TestStanzaPlugin)
stanza = TestStanza()
self.failUnless(stanza.match("foo"),
@@ -549,7 +549,7 @@ class TestElementBase(SleekTest):
interfaces = set(('bar', 'baz'))
plugin_attrib = 'qux'
- registerStanzaPlugin(TestStanza, TestStanza)
+ register_stanza_plugin(TestStanza, TestStanza)
stanza = TestStanza()
diff --git a/tests/test_stanza_gmail.py b/tests/test_stanza_gmail.py
index a5630e62..8ff65a3e 100644
--- a/tests/test_stanza_gmail.py
+++ b/tests/test_stanza_gmail.py
@@ -5,9 +5,9 @@ import sleekxmpp.plugins.gmail_notify as gmail
class TestGmail(SleekTest):
def setUp(self):
- registerStanzaPlugin(Iq, gmail.GmailQuery)
- registerStanzaPlugin(Iq, gmail.MailBox)
- registerStanzaPlugin(Iq, gmail.NewMail)
+ register_stanza_plugin(Iq, gmail.GmailQuery)
+ register_stanza_plugin(Iq, gmail.MailBox)
+ register_stanza_plugin(Iq, gmail.NewMail)
def testCreateQuery(self):
"""Testing querying Gmail for emails."""
diff --git a/tests/test_stanza_message.py b/tests/test_stanza_message.py
index d4f4d8d0..3ffe334e 100644
--- a/tests/test_stanza_message.py
+++ b/tests/test_stanza_message.py
@@ -6,7 +6,7 @@ from sleekxmpp.stanza.htmlim import HTMLIM
class TestMessageStanzas(SleekTest):
def setUp(self):
- registerStanzaPlugin(Message, HTMLIM)
+ register_stanza_plugin(Message, HTMLIM)
def testGroupchatReplyRegression(self):
"Regression groupchat reply should be to barejid"
diff --git a/tests/test_stanza_presence.py b/tests/test_stanza_presence.py
index ad357ec3..6a5a8b6e 100644
--- a/tests/test_stanza_presence.py
+++ b/tests/test_stanza_presence.py
@@ -16,7 +16,7 @@ class TestPresenceStanzas(SleekTest):
p['type'] = 'available'
self.check_presence(p, "<presence />")
self.failUnless(p['type'] == 'available',
- "Incorrect presence['type'] for type 'available'")
+ "Incorrect presence['type'] for type 'available': %s" % p['type'])
for showtype in ['away', 'chat', 'dnd', 'xa']:
p['type'] = showtype
diff --git a/tests/test_stanza_xep_0004.py b/tests/test_stanza_xep_0004.py
index 835f0dd6..5b3e490e 100644
--- a/tests/test_stanza_xep_0004.py
+++ b/tests/test_stanza_xep_0004.py
@@ -5,9 +5,9 @@ import sleekxmpp.plugins.xep_0004 as xep_0004
class TestDataForms(SleekTest):
def setUp(self):
- registerStanzaPlugin(Message, xep_0004.Form)
- registerStanzaPlugin(xep_0004.Form, xep_0004.FormField)
- registerStanzaPlugin(xep_0004.FormField, xep_0004.FieldOption)
+ register_stanza_plugin(Message, xep_0004.Form)
+ register_stanza_plugin(xep_0004.Form, xep_0004.FormField)
+ register_stanza_plugin(xep_0004.FormField, xep_0004.FieldOption)
def testMultipleInstructions(self):
"""Testing using multiple instructions elements in a data form."""
diff --git a/tests/test_stanza_xep_0030.py b/tests/test_stanza_xep_0030.py
index bb7ee6a3..c61583bf 100644
--- a/tests/test_stanza_xep_0030.py
+++ b/tests/test_stanza_xep_0030.py
@@ -5,8 +5,8 @@ import sleekxmpp.plugins.xep_0030 as xep_0030
class TestDisco(SleekTest):
def setUp(self):
- registerStanzaPlugin(Iq, xep_0030.DiscoInfo)
- registerStanzaPlugin(Iq, xep_0030.DiscoItems)
+ register_stanza_plugin(Iq, xep_0030.DiscoInfo)
+ register_stanza_plugin(Iq, xep_0030.DiscoItems)
def testCreateInfoQueryNoNode(self):
"""Testing disco#info query with no node."""
diff --git a/tests/test_stanza_xep_0033.py b/tests/test_stanza_xep_0033.py
index 90f6374a..378946a0 100644
--- a/tests/test_stanza_xep_0033.py
+++ b/tests/test_stanza_xep_0033.py
@@ -5,7 +5,7 @@ import sleekxmpp.plugins.xep_0033 as xep_0033
class TestAddresses(SleekTest):
def setUp(self):
- registerStanzaPlugin(Message, xep_0033.Addresses)
+ register_stanza_plugin(Message, xep_0033.Addresses)
def testAddAddress(self):
"""Testing adding extended stanza address."""
diff --git a/tests/test_stanza_xep_0085.py b/tests/test_stanza_xep_0085.py
index 5e63530f..a05ab4ce 100644
--- a/tests/test_stanza_xep_0085.py
+++ b/tests/test_stanza_xep_0085.py
@@ -4,11 +4,11 @@ import sleekxmpp.plugins.xep_0085 as xep_0085
class TestChatStates(SleekTest):
def setUp(self):
- 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)
+ register_stanza_plugin(Message, xep_0085.Active)
+ register_stanza_plugin(Message, xep_0085.Composing)
+ register_stanza_plugin(Message, xep_0085.Gone)
+ register_stanza_plugin(Message, xep_0085.Inactive)
+ register_stanza_plugin(Message, xep_0085.Paused)
def testCreateChatState(self):
"""Testing creating chat states."""