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):
|
2012-03-16 17:51:25 +00:00
|
|
|
request = """
|
|
|
|
<message>
|
|
|
|
<request xmlns="urn:xmpp:receipts" />
|
|
|
|
</message>
|
|
|
|
"""
|
2012-02-02 13:29:27 +00:00
|
|
|
|
|
|
|
msg = self.Message()
|
|
|
|
|
2012-03-16 17:51:25 +00:00
|
|
|
self.assertEqual(msg['request_receipt'], False)
|
2012-02-02 13:29:27 +00:00
|
|
|
|
2012-03-16 17:51:25 +00:00
|
|
|
msg['request_receipt'] = True
|
|
|
|
self.check(msg, request)
|
2012-02-02 13:29:27 +00:00
|
|
|
|
|
|
|
def testCreateReceived(self):
|
2012-03-16 17:51:25 +00:00
|
|
|
received = """
|
|
|
|
<message>
|
|
|
|
<received xmlns="urn:xmpp:receipts" id="1" />
|
|
|
|
</message>
|
|
|
|
"""
|
2012-02-02 13:29:27 +00:00
|
|
|
|
|
|
|
msg = self.Message()
|
|
|
|
|
2012-03-16 17:51:25 +00:00
|
|
|
msg['receipt'] = '1'
|
2012-02-02 13:29:27 +00:00
|
|
|
self.check(msg, received)
|
|
|
|
|
2012-03-16 17:51:25 +00:00
|
|
|
|
2012-02-02 13:29:27 +00:00
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestReciept)
|