diff options
| author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2010-12-21 14:06:42 +0000 |
|---|---|---|
| committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2010-12-21 14:13:15 +0000 |
| commit | 9e4ddfb989f05fb7a4c6c8f5c435e4319c7abd0d (patch) | |
| tree | c505ea77728b1a0f23c1357b6da2099d42503fe5 | |
| parent | 95e56df4a2a0acc89c86fd85eb25ae0e7cdb603d (diff) | |
create-at-startup: don't expect ObserveChannels calls so close together
Now that preparing the connection takes one more step, it can take
longer before ObserveChannels is called with the channel that just
appeared on connecting, so let's allow that to appear earlier.
This only relaxes the test assumptions a little. Although it currently
fails on 0.13.9 and this fixes it, it'll still work on tp-glib <
0.13.9.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
| -rw-r--r-- | test/twisted/dispatcher/create-at-startup.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/test/twisted/dispatcher/create-at-startup.py b/test/twisted/dispatcher/create-at-startup.py index ffb1a52d..ceec48bd 100644 --- a/test/twisted/dispatcher/create-at-startup.py +++ b/test/twisted/dispatcher/create-at-startup.py @@ -152,16 +152,30 @@ def test(q, bus, unused): # Now that the dispatcher is ready to go, we start looking for channels, # and also make the actual request - _, cm_request_call = q.expect_many( + # Empathy observes the channel we originally requested. + _, a, cm_request_call = q.expect_many( EventPattern('dbus-method-call', interface=cs.PROPERTIES_IFACE, method='GetAll', args=[cs.CONN_IFACE_REQUESTS], path=conn.object_path, handled=True), EventPattern('dbus-method-call', + path=client.object_path, + interface=cs.OBSERVER, method='ObserveChannels', + handled=False), + EventPattern('dbus-method-call', interface=cs.CONN_IFACE_REQUESTS, method='CreateChannel', path=conn.object_path, args=[request], handled=False), ) + assert a.args[0] == account.object_path, a.args + assert a.args[1] == conn.object_path, a.args + assert a.args[3] != '/', a.args # there is a dispatch operation + assert a.args[4] == [], a.args + channels = a.args[2] + assert len(channels) == 1, channels + assert channels[0][0] == announcement.object_path, channels + assert channels[0][1] == announcement_immutable, channels + # Time passes. A channel is returned. channel_immutable = dbus.Dictionary(request) @@ -178,25 +192,12 @@ def test(q, bus, unused): channel.object_path, channel.immutable, signature='oa{sv}') channel.announce() - # Empathy observes the channels, in the order they appeared - a = q.expect('dbus-method-call', - path=client.object_path, - interface=cs.OBSERVER, method='ObserveChannels', - handled=False) + # Empathy observes the newly-created channel. e = q.expect('dbus-method-call', path=client.object_path, interface=cs.OBSERVER, method='ObserveChannels', handled=False) - assert a.args[0] == account.object_path, a.args - assert a.args[1] == conn.object_path, a.args - assert a.args[3] != '/', a.args # there is a dispatch operation - assert a.args[4] == [], a.args - channels = a.args[2] - assert len(channels) == 1, channels - assert channels[0][0] == announcement.object_path, channels - assert channels[0][1] == announcement_immutable, channels - assert e.args[0] == account.object_path, e.args assert e.args[1] == conn.object_path, e.args assert e.args[3] == '/', e.args # no dispatch operation |
