summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-25 17:06:13 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-25 17:31:35 +0100
commitfcfe135a45329d25cd8886b3861f68ee736e672e (patch)
treee1be14ef00347b9551bd0732666dfea8699c7007
parentb864a277d76c54a803e9259cd65abe1dfdc624d3 (diff)
downloadtelepathy-mission-control-fcfe135a45329d25cd8886b3861f68ee736e672e.tar.gz
Add a regression test for fd.o #25684
This turns out to be a regression in the 5.5 branch, but adding a test in the stable branch seems a good way to avoid introducing this bug.
-rw-r--r--test/twisted/Makefile.am1
-rw-r--r--test/twisted/account-manager/create-twice.py64
2 files changed, 65 insertions, 0 deletions
diff --git a/test/twisted/Makefile.am b/test/twisted/Makefile.am
index 093d3f67..e0c72acb 100644
--- a/test/twisted/Makefile.am
+++ b/test/twisted/Makefile.am
@@ -5,6 +5,7 @@ TWISTED_BASIC_TESTS = \
account-manager/bad-cm.py \
account-manager/avatar.py \
account-manager/create-auto-connect.py \
+ account-manager/create-twice.py \
account-manager/create-with-properties.py \
account-manager/enable.py \
account-manager/enable-auto-connect.py \
diff --git a/test/twisted/account-manager/create-twice.py b/test/twisted/account-manager/create-twice.py
new file mode 100644
index 00000000..9aa3155f
--- /dev/null
+++ b/test/twisted/account-manager/create-twice.py
@@ -0,0 +1,64 @@
+# Copyright (C) 2009 Nokia Corporation
+# Copyright (C) 2009-2010 Collabora Ltd.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+import dbus
+import dbus
+import dbus.service
+
+from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
+ call_async
+from mctest import exec_test, create_fakecm_account, get_account_manager
+import constants as cs
+
+def test(q, bus, mc):
+ account_manager = get_account_manager(bus)
+ account_manager_iface = dbus.Interface(account_manager, cs.AM)
+
+ # fd.o #25684: creating similarly-named accounts in very quick succession
+ # used to fail
+
+ params = dbus.Dictionary({"account": "anarki",
+ "password": "secrecy"}, signature='sv')
+
+ cm_name_ref = dbus.service.BusName(cs.tp_name_prefix +
+ '.ConnectionManager.fakecm', bus=bus)
+ account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+ am_iface = dbus.Interface(account_manager, cs.AM)
+
+ call_async(q, am_iface, 'CreateAccount',
+ 'fakecm',
+ 'fakeprotocol',
+ 'fakeaccount',
+ params,
+ {})
+ call_async(q, am_iface, 'CreateAccount',
+ 'fakecm',
+ 'fakeprotocol',
+ 'fakeaccount',
+ params,
+ {})
+
+ ret1 = q.expect('dbus-return', method='CreateAccount')
+ ret2 = q.expect('dbus-return', method='CreateAccount')
+
+ path1 = ret1.value[0]
+ path2 = ret2.value[0]
+ assert path1 != path2
+
+if __name__ == '__main__':
+ exec_test(test, {})