diff options
author | mathieui <mathieui@mathieui.net> | 2021-02-14 12:11:58 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-02-26 00:08:56 +0100 |
commit | d17967f58e05b090c4973cee320792dd82db2513 (patch) | |
tree | b3c14f92450e106910c3037448a7d02c41d57731 /tests/test_stream_xep_0047.py | |
parent | 13de36baa1ad0b57fd674f514203d3ea34ee5c7d (diff) | |
download | slixmpp-d17967f58e05b090c4973cee320792dd82db2513.tar.gz slixmpp-d17967f58e05b090c4973cee320792dd82db2513.tar.bz2 slixmpp-d17967f58e05b090c4973cee320792dd82db2513.tar.xz slixmpp-d17967f58e05b090c4973cee320792dd82db2513.zip |
XEP-0047: API changes
and fix unit tests broken for years.
Diffstat (limited to 'tests/test_stream_xep_0047.py')
-rw-r--r-- | tests/test_stream_xep_0047.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tests/test_stream_xep_0047.py b/tests/test_stream_xep_0047.py index 53225df5..a44ffbec 100644 --- a/tests/test_stream_xep_0047.py +++ b/tests/test_stream_xep_0047.py @@ -14,7 +14,7 @@ class TestInBandByteStreams(SlixTest): def tearDown(self): self.stream_close() - async def testOpenStream(self): + def testOpenStream(self): """Test requesting a stream, successfully""" events = [] @@ -25,8 +25,9 @@ class TestInBandByteStreams(SlixTest): self.xmpp.add_event_handler('ibb_stream_start', on_stream_start) - await self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', - sid='testing') + self.xmpp.wrap(self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', + sid='testing')) + self.wait_() self.send(""" <iq type="set" to="tester@localhost/receiver" id="1"> @@ -45,7 +46,7 @@ class TestInBandByteStreams(SlixTest): self.assertEqual(events, ['ibb_stream_start']) - async def testAysncOpenStream(self): + def testAysncOpenStream(self): """Test requesting a stream, aysnc""" events = set() @@ -58,9 +59,10 @@ class TestInBandByteStreams(SlixTest): self.xmpp.add_event_handler('ibb_stream_start', on_stream_start) - await self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', - sid='testing', - callback=stream_callback) + self.xmpp.wrap(self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', + sid='testing', + callback=stream_callback)) + self.wait_() self.send(""" <iq type="set" to="tester@localhost/receiver" id="1"> @@ -79,7 +81,7 @@ class TestInBandByteStreams(SlixTest): self.assertEqual(events, {'ibb_stream_start', 'callback'}) - async def testSendData(self): + def testSendData(self): """Test sending data over an in-band bytestream.""" streams = [] @@ -89,13 +91,14 @@ class TestInBandByteStreams(SlixTest): streams.append(stream) def on_stream_data(d): - data.append(d['data']) + data.append(d.read()) self.xmpp.add_event_handler('ibb_stream_start', on_stream_start) self.xmpp.add_event_handler('ibb_stream_data', on_stream_data) - self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', - sid='testing') + self.xmpp.wrap(self.xmpp['xep_0047'].open_stream('tester@localhost/receiver', + sid='testing')) + self.wait_() self.send(""" <iq type="set" to="tester@localhost/receiver" id="1"> @@ -116,7 +119,8 @@ class TestInBandByteStreams(SlixTest): # Test sending data out - await stream.send("Testing") + self.xmpp.wrap(stream.send("Testing")) + self.wait_() self.send(""" <iq type="set" id="2" |