mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
d0c506f930
* check_stanza does not require stanza_class parameter. Introspection! * check_message, check_iq, and check_presence removed -- use check instead. * stream_send_stanza, stream_send_message, stream_send_iq, and stream_send_presence removed -- use send instead. * Use recv instead of recv_message, recv_presence, etc. * check_jid instead of check_JID * stream_start may accept multi=True to return a new SleekTest instance for testing multiple streams at once.
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from sleekxmpp.test import *
|
|
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)
|
|
|
|
def testCreateChatState(self):
|
|
"""Testing creating chat states."""
|
|
|
|
xmlstring = """
|
|
<message>
|
|
<%s xmlns="http://jabber.org/protocol/chatstates" />
|
|
</message>
|
|
"""
|
|
|
|
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)
|
|
|
|
|
|
msg['chat_state'].gone()
|
|
self.check(msg, xmlstring % 'gone',
|
|
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)
|
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)
|