slixmpp/tests/test_stanza_xep_0184.py

42 lines
993 B
Python
Raw Normal View History

2013-07-26 11:02:26 +00:00
import unittest
2014-07-17 12:19:04 +00:00
from slixmpp import Message
from slixmpp.test import SlixTest
import slixmpp.plugins.xep_0184 as xep_0184
from slixmpp.xmlstream import register_stanza_plugin
2012-02-02 13:29:27 +00:00
2014-07-17 12:19:04 +00:00
class TestReciept(SlixTest):
2012-02-02 13:29:27 +00:00
def setUp(self):
register_stanza_plugin(Message, xep_0184.Request)
register_stanza_plugin(Message, xep_0184.Received)
def testCreateRequest(self):
request = """
<message>
<request xmlns="urn:xmpp:receipts" />
</message>
"""
2012-02-02 13:29:27 +00:00
msg = self.Message()
self.assertEqual(msg['request_receipt'], False)
2012-02-02 13:29:27 +00:00
msg['request_receipt'] = True
self.check(msg, request)
2012-02-02 13:29:27 +00:00
def testCreateReceived(self):
received = """
<message>
<received xmlns="urn:xmpp:receipts" id="1" />
</message>
"""
2012-02-02 13:29:27 +00:00
msg = self.Message()
msg['receipt'] = '1'
2012-02-02 13:29:27 +00:00
self.check(msg, received)
2012-02-02 13:29:27 +00:00
suite = unittest.TestLoader().loadTestsFromTestCase(TestReciept)