[Telepathy-commits] [telepathy-mission-control/master] Add a test for various ways to fail at creating an account
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Mar 26 09:08:27 PDT 2009
Unfortunately, the first two of these scenarios currently cause MC to
dump core :-( so the test is not currently connected up.
---
test/twisted/Makefile.am | 1 +
test/twisted/account-bad-cm.py | 59 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)
create mode 100644 test/twisted/account-bad-cm.py
diff --git a/test/twisted/Makefile.am b/test/twisted/Makefile.am
index 603d6e2..a088d55 100644
--- a/test/twisted/Makefile.am
+++ b/test/twisted/Makefile.am
@@ -1,6 +1,7 @@
TWISTED_TESTS =
TWISTED_BASIC_TESTS = \
+ account-bad-cm.py \
do-nothing.py \
test-account.py \
test-connect.py
diff --git a/test/twisted/account-bad-cm.py b/test/twisted/account-bad-cm.py
new file mode 100644
index 0000000..d41a5e1
--- /dev/null
+++ b/test/twisted/account-bad-cm.py
@@ -0,0 +1,59 @@
+print "Skipping test that is known to fail:"
+print " http://bugs.freedesktop.org/show_bug.cgi?id=20880"
+raise SystemExit(77)
+
+import dbus
+
+from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
+ call_async
+from fakecm import start_fake_connection_manager
+from mctest import exec_test
+import constants as cs
+
+FakeCM_bus_name = "com.example.FakeCM"
+ConnectionManager_object_path = "/com/example/FakeCM/ConnectionManager"
+
+
+def test(q, bus, mc):
+ # Get the AccountManager interface
+ account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+ account_manager_iface = dbus.Interface(account_manager, cs.AM)
+
+ # Create an account with a bad Connection_Manager - it should fail
+
+ params = dbus.Dictionary({"account": "someguy at example.com",
+ "password": "secrecy"}, signature='sv')
+ call_async(q, account_manager_iface, 'CreateAccount',
+ 'nonexistent_cm', # Connection_Manager
+ 'fakeprotocol', # Protocol
+ 'fakeaccount', #Display_Name
+ params, # Parameters
+ )
+ q.expect('dbus-error', method='CreateAccount')
+
+ # Create an account with a bad Protocol - it should fail
+
+ params = dbus.Dictionary({"account": "someguy at example.com",
+ "password": "secrecy"}, signature='sv')
+ call_async(q, account_manager_iface, 'CreateAccount',
+ 'fakecm', # Connection_Manager
+ 'nonexistent-protocol', # Protocol
+ 'fakeaccount', #Display_Name
+ params, # Parameters
+ )
+ q.expect('dbus-error', method='CreateAccount')
+
+ # Create an account with incomplete Parameters - it should fail
+
+ params = dbus.Dictionary({"account": "someguy at example.com"},
+ signature='sv')
+ call_async(q, account_manager_iface, 'CreateAccount',
+ 'fakecm', # Connection_Manager
+ 'fakeprotocol', # Protocol
+ 'fakeaccount', #Display_Name
+ params, # Parameters
+ )
+ q.expect('dbus-error', method='CreateAccount')
+
+if __name__ == '__main__':
+ exec_test(test, {})
--
1.5.6.5
More information about the telepathy-commits
mailing list