telepathy-haze: Test closing the request_password channel
Will Thompson
wjt at kemper.freedesktop.org
Fri Apr 12 03:21:34 PDT 2013
Module: telepathy-haze
Branch: master
Commit: ab6c82bbc49a4faac136fe6b2422bb9508b1a960
URL: http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=ab6c82bbc49a4faac136fe6b2422bb9508b1a960
Author: Will Thompson <will.thompson at collabora.co.uk>
Date: Fri Apr 12 11:20:42 2013 +0100
Test closing the request_password channel
---
tests/twisted/Makefile.am | 1 +
tests/twisted/sasl/close.py | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 3777c89..2b92404 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -11,6 +11,7 @@ TWISTED_TESTS = \
roster/publish.py \
roster/removed-from-rp-subscribe.py \
roster/subscribe.py \
+ sasl/close.py \
sasl/telepathy-password.py \
text/destroy.py \
text/ensure.py \
diff --git a/tests/twisted/sasl/close.py b/tests/twisted/sasl/close.py
new file mode 100644
index 0000000..a7d26f8
--- /dev/null
+++ b/tests/twisted/sasl/close.py
@@ -0,0 +1,43 @@
+"""Test the SASL channel being undispatchable."""
+
+import dbus
+
+from servicetest import EventPattern
+from hazetest import exec_test, assertEquals
+import constants as cs
+from saslutil import connect_and_get_sasl_channel
+
+JID = 'weaver at crobuzon.fic'
+
+def test_no_password(q, bus, conn, stream):
+ chan, props = connect_and_get_sasl_channel(q, bus, conn)
+
+ chan.Close()
+
+ _, _, status_changed = q.expect_many(
+ EventPattern('dbus-signal', path=chan.object_path,
+ signal='Closed'),
+ EventPattern('dbus-signal', path=conn.object_path,
+ signal='ChannelClosed', args=[chan.object_path]),
+ # Unhelpfully prpl-jabber just sets the account to disabled so we
+ # don't get an error.
+ # EventPattern('dbus-signal', path=conn.object_path,
+ # signal='ConnectionError',
+ # predicate=lambda e: e.args[0] == cs.AUTHENTICATION_FAILED),
+ EventPattern('dbus-signal', path=conn.object_path,
+ signal='StatusChanged'),
+ )
+
+ status, reason = status_changed.args
+ assertEquals(cs.CONN_STATUS_DISCONNECTED, status)
+ # We would like to have
+ # assertEquals(cs.CSR_AUTHENTICATION_FAILED, reason)
+
+ # prpl-sipe does actually report a connection error rather
+ # than just disabling the account, so yay. prpl-silc sets
+ # PURPLE_CONNECTION_ERROR_OTHER_ERROR, which also comes out as
+ # AUTHENTICATION_FAILED. No other prpls use
+ # purple_account_request_password().
+
+if __name__ == '__main__':
+ exec_test(test_no_password, {'password': None,'account' : JID}, do_connect=False)
More information about the telepathy-commits
mailing list