telepathy-gabble: sasl/abort.py: clean up invoking test cases
Will Thompson
wjt at kemper.freedesktop.org
Thu Dec 6 09:56:39 PST 2012
Module: telepathy-gabble
Branch: master
Commit: ea9c62166997004b97dc4a044d44df57ea4c9d91
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=ea9c62166997004b97dc4a044d44df57ea4c9d91
Author: Will Thompson <will.thompson at collabora.co.uk>
Date: Tue Nov 6 17:51:52 2012 +0000
sasl/abort.py: clean up invoking test cases
---
tests/twisted/sasl/abort.py | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/tests/twisted/sasl/abort.py b/tests/twisted/sasl/abort.py
index 2c906f6..45fd4d5 100644
--- a/tests/twisted/sasl/abort.py
+++ b/tests/twisted/sasl/abort.py
@@ -95,22 +95,16 @@ def test_abort_connected(q, bus, conn, stream):
q.expect('dbus-error', method='AbortSASL', name=cs.NOT_AVAILABLE)
chan.Close()
+def exec_test_(func):
+ # Can't use functools.partial, because the authenticator is stateful.
+ authenticator = SaslEventAuthenticator(JID.split('@')[0], MECHANISMS)
+ exec_test(func, do_connect=False, authenticator=authenticator,
+ params={'password': None,
+ 'account' : JID,
+ })
+
if __name__ == '__main__':
- exec_test(test_abort_early,
- {'password': None,'account' : JID}, do_connect=False)
-
- exec_test(test_abort_mid,
- {'password': None,'account' : JID},
- authenticator=SaslEventAuthenticator(JID.split('@')[0],
- MECHANISMS),
- do_connect=False)
- exec_test(test_disconnect_mid,
- {'password': None,'account' : JID},
- authenticator=SaslEventAuthenticator(JID.split('@')[0],
- MECHANISMS),
- do_connect=False)
-
- exec_test(
- test_abort_connected, {'password': None,'account' : JID},
- authenticator=SaslEventAuthenticator(JID.split('@')[0], ['PLAIN']),
- do_connect=False)
+ exec_test_(test_abort_early)
+ exec_test_(test_abort_mid)
+ exec_test_(test_disconnect_mid)
+ exec_test_(test_abort_connected)
More information about the telepathy-commits
mailing list