telepathy-gabble: tests: add a couple more cases to sasl/abort

Will Thompson wjt at kemper.freedesktop.org
Thu Dec 6 09:56:46 PST 2012


Module: telepathy-gabble
Branch: master
Commit: a743f0475e440b8b9712df20bb8d997ff6f23177
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=a743f0475e440b8b9712df20bb8d997ff6f23177

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Tue Nov 20 16:21:30 2012 +0000

tests: add a couple more cases to sasl/abort

There's no reason these should be any different, but I thought it might
be worth trying them anyway.

---

 tests/twisted/sasl/abort.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/sasl/abort.py b/tests/twisted/sasl/abort.py
index 908e166..425b94b 100644
--- a/tests/twisted/sasl/abort.py
+++ b/tests/twisted/sasl/abort.py
@@ -158,6 +158,21 @@ def test_abort_then_failure(q, bus, conn, stream):
             cs.SASL_ABORT_REASON_USER_ABORT, "bored now"),
         lambda authenticator: authenticator.not_authorized())
 
+def abort_and_close(chan):
+    chan.SASLAuthentication.AbortSASL(
+        cs.SASL_ABORT_REASON_USER_ABORT, "bored now")
+    chan.Close()
+
+def test_abort_and_close_then_challenge(q, bus, conn, stream):
+    test_give_up_while_waiting(q, bus, conn, stream,
+        abort_and_close,
+        lambda authenticator: authenticator.challenge(EXCHANGE[1][0]))
+
+def test_abort_and_close_then_failure(q, bus, conn, stream):
+    test_give_up_while_waiting(q, bus, conn, stream,
+        abort_and_close,
+        lambda authenticator: authenticator.not_authorized())
+
 def exec_test_(func):
     # Can't use functools.partial, because the authenticator is stateful.
     authenticator = SaslEventAuthenticator(JID.split('@')[0], MECHANISMS)
@@ -177,3 +192,5 @@ if __name__ == '__main__':
     exec_test_(test_abort_then_challenge)
     # exec_test_(test_abort_then_success)
     exec_test_(test_abort_then_failure)
+    exec_test_(test_abort_and_close_then_challenge)
+    exec_test_(test_abort_and_close_then_failure)



More information about the telepathy-commits mailing list