summaryrefslogtreecommitdiff
path: root/tests/test_stream_handlers.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-10-31 13:42:32 -0700
committerLance Stout <lancestout@gmail.com>2012-10-31 13:42:32 -0700
commit4b7ec4a32ac15dfa35b3282793a8317cfd32837b (patch)
tree626c0287a09b81ed5415de95f9adeb24ad42293a /tests/test_stream_handlers.py
parenta00eee1bbee83b2435b09be6c4175c3649fa797b (diff)
parent2229ad8d8e51b73a7900b118dfab5d7b449f17ce (diff)
downloadslixmpp-4b7ec4a32ac15dfa35b3282793a8317cfd32837b.tar.gz
slixmpp-4b7ec4a32ac15dfa35b3282793a8317cfd32837b.tar.bz2
slixmpp-4b7ec4a32ac15dfa35b3282793a8317cfd32837b.tar.xz
slixmpp-4b7ec4a32ac15dfa35b3282793a8317cfd32837b.zip
Merge branch 'master' into develop
Diffstat (limited to 'tests/test_stream_handlers.py')
-rw-r--r--tests/test_stream_handlers.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_stream_handlers.py b/tests/test_stream_handlers.py
index 7fd4e648..d3850a94 100644
--- a/tests/test_stream_handlers.py
+++ b/tests/test_stream_handlers.py
@@ -153,6 +153,35 @@ class TestHandlers(SleekTest):
self.failUnless(events == ['foo'],
"Iq callback was not executed: %s" % events)
+ def testIqTimeoutCallback(self):
+ """Test that iq.send(tcallback=handle_foo, timeout_callback=handle_timeout) works."""
+ events = []
+
+ def handle_foo(iq):
+ events.append('foo')
+
+ def handle_timeout(iq):
+ events.append('timeout')
+
+ iq = self.Iq()
+ iq['type'] = 'get'
+ iq['id'] = 'test-foo'
+ iq['to'] = 'user@localhost'
+ iq['query'] = 'foo'
+ iq.send(callback=handle_foo, timeout_callback=handle_timeout, timeout=0.05)
+
+ self.send("""
+ <iq type="get" id="test-foo" to="user@localhost">
+ <query xmlns="foo" />
+ </iq>
+ """)
+
+ # Give event queue time to process
+ time.sleep(1)
+
+ self.failUnless(events == ['timeout'],
+ "Iq timeout was not executed: %s" % events)
+
def testMultipleHandlersForStanza(self):
"""
Test that multiple handlers for a single stanza work