summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0085.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-02-24 12:10:29 -0500
committerLance Stout <lancestout@gmail.com>2011-02-24 12:10:29 -0500
commit77251452c106618ab1cfdad546eb224bc9693dea (patch)
treed89c5abe12e9a069996925c8de14119463a732be /tests/test_stanza_xep_0085.py
parent4df3aa569bc8e88b70986022e558ee9024dd7ffb (diff)
downloadslixmpp-77251452c106618ab1cfdad546eb224bc9693dea.tar.gz
slixmpp-77251452c106618ab1cfdad546eb224bc9693dea.tar.bz2
slixmpp-77251452c106618ab1cfdad546eb224bc9693dea.tar.xz
slixmpp-77251452c106618ab1cfdad546eb224bc9693dea.zip
Updated the XEP-0085 plugin.
Can now be used as so: >>> msg['chat_state'] '' >>> msg <message /> >>> msg['chat_state'] = 'paused' >>> msg <message> <paused xmlns="http://jabber.org/protocol/chatstates" /> </message> >>> msg['chat_state'] 'paused' >>> del msg['chat_state'] >>> msg <message />
Diffstat (limited to 'tests/test_stanza_xep_0085.py')
-rw-r--r--tests/test_stanza_xep_0085.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/tests/test_stanza_xep_0085.py b/tests/test_stanza_xep_0085.py
index 5db7139a..b08404e2 100644
--- a/tests/test_stanza_xep_0085.py
+++ b/tests/test_stanza_xep_0085.py
@@ -4,11 +4,7 @@ import sleekxmpp.plugins.xep_0085 as xep_0085
class TestChatStates(SleekTest):
def setUp(self):
- 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)
+ register_stanza_plugin(Message, xep_0085.ChatState)
def testCreateChatState(self):
"""Testing creating chat states."""
@@ -20,25 +16,26 @@ class TestChatStates(SleekTest):
"""
msg = self.Message()
- msg['chat_state'].active()
- self.check(msg, xmlstring % 'active',
- use_values=False)
- msg['chat_state'].composing()
- self.check(msg, xmlstring % 'composing',
- use_values=False)
+ self.assertEqual(msg['chat_state'], '')
+ self.check(msg, "<message />", use_values=False)
+ msg['chat_state'] = 'active'
+ self.check(msg, xmlstring % 'active', use_values=False)
- msg['chat_state'].gone()
- self.check(msg, xmlstring % 'gone',
- use_values=False)
+ msg['chat_state'] = 'composing'
+ self.check(msg, xmlstring % 'composing', use_values=False)
- msg['chat_state'].inactive()
- self.check(msg, xmlstring % 'inactive',
- use_values=False)
+ msg['chat_state'] = 'gone'
+ self.check(msg, xmlstring % 'gone', use_values=False)
- msg['chat_state'].paused()
- self.check(msg, xmlstring % 'paused',
- use_values=False)
+ msg['chat_state'] = 'inactive'
+ self.check(msg, xmlstring % 'inactive', use_values=False)
+
+ msg['chat_state'] = 'paused'
+ self.check(msg, xmlstring % 'paused', use_values=False)
+
+ del msg['chat_state']
+ self.check(msg, "<message />")
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)