[telepathy-haze/master] Add a regression test for fd.o #18361
Will Thompson
will.thompson at collabora.co.uk
Wed Mar 25 17:46:17 PDT 2009
---
tests/twisted/Makefile.am | 3 +-
tests/twisted/connect/twice-to-same-account.py | 51 ++++++++++++++++++++++++
tests/twisted/constants.py | 2 +
3 files changed, 55 insertions(+), 1 deletions(-)
create mode 100644 tests/twisted/connect/twice-to-same-account.py
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 21719d8..9177621 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -1,6 +1,7 @@
TWISTED_TESTS = \
- connect/success.py \
connect/fail.py \
+ connect/success.py \
+ connect/twice-to-same-account.py \
presence/presence.py \
text/destroy.py \
text/ensure.py \
diff --git a/tests/twisted/connect/twice-to-same-account.py b/tests/twisted/connect/twice-to-same-account.py
new file mode 100644
index 0000000..ef008d2
--- /dev/null
+++ b/tests/twisted/connect/twice-to-same-account.py
@@ -0,0 +1,51 @@
+"""
+Regression test for <https://bugs.freedesktop.org/show_bug.cgi?id=18361>:
+requesting a connection for an account that's already connected crashed Haze
+shortly afterwards.
+"""
+
+import dbus
+
+from hazetest import exec_test
+from servicetest import tp_name_prefix, tp_path_prefix
+import constants as cs
+
+def test(q, bus, conn, stream):
+ conn.Connect()
+ q.expect('dbus-signal', signal='StatusChanged', args=[1, 1])
+ q.expect('stream-authenticated')
+
+ # FIXME: unlike Gabble, Haze does not signal a presence update to
+ # available during connect
+ #q.expect('dbus-signal', signal='PresenceUpdate',
+ # args=[{1L: (0L, {u'available': {}})}])
+
+ q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+ haze = bus.get_object(
+ tp_name_prefix + '.ConnectionManager.haze',
+ tp_path_prefix + '/ConnectionManager/haze')
+ cm_iface = dbus.Interface(haze, cs.CM)
+
+ params = {
+ 'account': 'test at localhost/Resource',
+ 'password': 'pass',
+ 'server': 'localhost',
+ # FIXME: the spec says this is a UInt32 and Gabble agrees
+ 'port': dbus.Int32(4242),
+ }
+
+ # You might think that this is the test...
+ try:
+ cm_iface.RequestConnection('jabber', params)
+ except dbus.DBusException, e:
+ # tp-glib <0.7.28 got the error domain wrong! :D
+ assert e.get_dbus_name().endswith("NotAvailable")
+
+ # but you'd be wrong: we now test that Haze is still alive.
+ conn.Disconnect()
+ q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+ exec_test(test)
+
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index ca2efec..5d8734c 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -4,6 +4,8 @@ Some handy constants for other tests to share and enjoy.
from dbus import PROPERTIES_IFACE
+CM = "org.freedesktop.Telepathy.ConnectionManager"
+
HT_CONTACT = 1
HT_ROOM = 2
--
1.5.6.5
More information about the telepathy-commits
mailing list