From fcfe135a45329d25cd8886b3861f68ee736e672e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 25 May 2010 17:06:13 +0100 Subject: 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. --- test/twisted/Makefile.am | 1 + test/twisted/account-manager/create-twice.py | 64 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 test/twisted/account-manager/create-twice.py 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, {}) -- cgit v1.2.1