1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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@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@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@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, {})
|