summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2013-04-12 11:20:42 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2013-04-12 11:20:42 +0100
commitab6c82bbc49a4faac136fe6b2422bb9508b1a960 (patch)
tree8e44043533dd8c850b28d20ad9180b537f53e7a7
parent4541819cc4133d1dfe6d3766c6cf8f0204a4c65f (diff)
downloadtelepathy-haze-ab6c82bbc49a4faac136fe6b2422bb9508b1a960.tar.gz
Test closing the request_password channel
-rw-r--r--tests/twisted/Makefile.am1
-rw-r--r--tests/twisted/sasl/close.py43
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@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)