slixmpp/tests/test_stream_xep_0066.py
mathieui 1e2665df19
Update the test suite.
- monkey-patch our own monkey-patched idle_call to run events immediatly
  rather than adding them to the event queue, and add a fake transport
  with a fake socket.
- remove the test file related to xep_0059 as it relies on blocking
  behavior, and comment out one xep_0030 test uses xep_0059
- remove many instances of threading and sleep()s because they do
  nothing except waste time and introduce race conditions.
- keep exactly two sleep() in IoT xeps because they rely on timeouts
2015-02-12 12:23:47 +01:00

37 lines
984 B
Python

import threading
import unittest
from slixmpp.test import SlixTest
class TestOOB(SlixTest):
def tearDown(self):
self.stream_close()
def testSendOOB(self):
"""Test sending an OOB transfer request."""
self.stream_start(plugins=['xep_0066', 'xep_0030'])
url = 'http://github.com/fritzy/Slixmpp/blob/master/README'
self.xmpp['xep_0066'].send_oob('user@example.com', url,
desc='Slixmpp README')
self.send("""
<iq to="user@example.com" type="set" id="1">
<query xmlns="jabber:iq:oob">
<url>http://github.com/fritzy/Slixmpp/blob/master/README</url>
<desc>Slixmpp README</desc>
</query>
</iq>
""")
self.recv("""
<iq id="1" type="result"
to="tester@localhost"
from="user@example.com" />
""")
suite = unittest.TestLoader().loadTestsFromTestCase(TestOOB)