summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-10 14:29:12 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-02-10 15:12:32 +0100
commitf92ab5cf6245fb83ebf02bbe5e83bdd67c0827c9 (patch)
tree163b121a2e33aa416cba6189fca27a337bf9d248
parent6700104d832a51ef3742a733901b6e54674e71bc (diff)
new {Observe,Handle}Channel API
-rw-r--r--src/mcd-client.c26
-rw-r--r--src/mcd-dispatch-operation.c55
-rw-r--r--tests/twisted/account-requests/create-text.py4
-rw-r--r--tests/twisted/dispatcher/already-has-channel.py4
-rw-r--r--tests/twisted/dispatcher/approver-fails.py2
-rw-r--r--tests/twisted/dispatcher/bypass-approval.py2
-rw-r--r--tests/twisted/dispatcher/capture-bundle.py6
-rw-r--r--tests/twisted/dispatcher/create-at-startup.py6
-rw-r--r--tests/twisted/dispatcher/create-handler-fails.py6
-rw-r--r--tests/twisted/dispatcher/create-hints.py9
-rw-r--r--tests/twisted/dispatcher/create-no-preferred-handler.py8
-rw-r--r--tests/twisted/dispatcher/create-text.py9
-rw-r--r--tests/twisted/dispatcher/created-behind-our-back.py4
-rw-r--r--tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py4
-rw-r--r--tests/twisted/dispatcher/dispatch-text.py6
-rw-r--r--tests/twisted/dispatcher/ensure-and-redispatch.py6
-rw-r--r--tests/twisted/dispatcher/ensure-is-approval.py4
-rw-r--r--tests/twisted/dispatcher/ensure-rapidly.py10
-rw-r--r--tests/twisted/dispatcher/exploding-bundles.py4
-rw-r--r--tests/twisted/dispatcher/handle-channels-fails.py2
-rw-r--r--tests/twisted/dispatcher/recover-from-disconnect.py2
-rw-r--r--tests/twisted/dispatcher/respawn-activatable-observers.py4
-rw-r--r--tests/twisted/dispatcher/respawn-observers.py8
23 files changed, 72 insertions, 119 deletions
diff --git a/src/mcd-client.c b/src/mcd-client.c
index b36cf301..6a1522e7 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -584,18 +584,14 @@ void
_mcd_client_recover_observer (McdClientProxy *self, TpChannel *channel,
const gchar *account_path)
{
- GPtrArray *satisfied_requests;
- GHashTable *observer_info;
+ GHashTable *observer_info, *satisfied_requests;
TpConnection *conn;
const gchar *connection_path, *chan_path;
GHashTable *chan_props;
- satisfied_requests = g_ptr_array_new ();
+ satisfied_requests = g_hash_table_new (NULL, NULL);
observer_info = g_hash_table_new (g_str_hash, g_str_equal);
tp_asv_set_boolean (observer_info, "recovering", TRUE);
- tp_asv_set_boxed (observer_info, "request-properties",
- TP_HASH_TYPE_OBJECT_IMMUTABLE_PROPERTIES_MAP,
- g_hash_table_new (NULL, NULL));
conn = tp_channel_get_connection (channel);
connection_path = tp_proxy_get_object_path (conn);
@@ -611,7 +607,7 @@ _mcd_client_recover_observer (McdClientProxy *self, TpChannel *channel,
"/", satisfied_requests, observer_info,
NULL, NULL, NULL, NULL);
- g_ptr_array_unref (satisfied_requests);
+ g_hash_table_unref (satisfied_requests);
g_hash_table_unref (observer_info);
g_hash_table_unref (chan_props);
}
@@ -1651,11 +1647,10 @@ _mcd_client_proxy_handle_channel (McdClientProxy *self,
GDestroyNotify destroy,
GObject *weak_object)
{
- GHashTable *chan_props;
- GPtrArray *requests_satisfied;
+ GHashTable *chan_props, *requests_satisfied;
gint64 req_time = 0;
GHashTable *requests;
- gpointer path;
+ gpointer path, request;
GHashTableIter it;
g_return_if_fail (MCD_IS_CLIENT_PROXY (self));
@@ -1663,7 +1658,8 @@ _mcd_client_proxy_handle_channel (McdClientProxy *self,
DEBUG ("calling HandleChannel on %s", tp_proxy_get_bus_name (self));
- requests_satisfied = g_ptr_array_new_with_free_func (g_free);
+ requests_satisfied = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
+ (GDestroyNotify) g_hash_table_unref);
if (handler_info == NULL)
{
@@ -1677,9 +1673,11 @@ _mcd_client_proxy_handle_channel (McdClientProxy *self,
requests = _mcd_channel_get_satisfied_requests (channel, &req_time);
g_hash_table_iter_init (&it, requests);
- while (g_hash_table_iter_next (&it, &path, NULL))
+ while (g_hash_table_iter_next (&it, &path, &request))
{
- g_ptr_array_add (requests_satisfied, g_strdup (path));
+ GHashTable *props = _mcd_request_dup_immutable_properties (MCD_REQUEST (request));
+
+ g_hash_table_insert (requests_satisfied, g_strdup (path), props);
}
g_hash_table_unref (requests);
@@ -1704,7 +1702,7 @@ _mcd_client_proxy_handle_channel (McdClientProxy *self,
requests_satisfied, user_action_time, handler_info,
callback, user_data, destroy, weak_object);
- g_ptr_array_unref (requests_satisfied);
+ g_hash_table_unref (requests_satisfied);
g_hash_table_unref (handler_info);
g_hash_table_unref (chan_props);
}
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 4e5664b4..aee28469 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1922,28 +1922,19 @@ observe_channels_cb (TpClient *proxy, const GError *error,
}
/*
- * @paths_out: (out) (transfer container) (element-type utf8):
- * Requests_Satisfied
- * @props_out: (out) (transfer container) (element-type utf8 GHashTable):
- * request-properties for Observer_Info or Handler_Info
+ * Return: (transfer container): (gchar *)request_path -> (GHashTable *) props
*/
-static void
-collect_satisfied_requests (McdChannel *channel,
- GPtrArray **paths_out,
- GHashTable **props_out)
+static GHashTable *
+collect_satisfied_requests (McdChannel *channel)
{
GHashTableIter it;
gpointer path, value;
- GPtrArray *satisfied_requests;
- GHashTable *request_properties;
+ GHashTable *satisfied_requests;
GHashTable *reqs;
reqs = _mcd_channel_get_satisfied_requests (channel, NULL);
- satisfied_requests = g_ptr_array_sized_new (g_hash_table_size (reqs));
- g_ptr_array_set_free_func (satisfied_requests, g_free);
-
- request_properties = g_hash_table_new_full (g_str_hash, g_str_equal,
+ satisfied_requests = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_hash_table_unref);
g_hash_table_iter_init (&it, reqs);
@@ -1952,23 +1943,14 @@ collect_satisfied_requests (McdChannel *channel,
{
GHashTable *props;
- g_ptr_array_add (satisfied_requests, g_strdup (path));
props = _mcd_request_dup_immutable_properties (value);
g_assert (props != NULL);
- g_hash_table_insert (request_properties, g_strdup (path), props);
+ g_hash_table_insert (satisfied_requests, g_strdup (path), props);
}
g_hash_table_unref (reqs);
- if (paths_out != NULL)
- *paths_out = satisfied_requests;
- else
- g_ptr_array_unref (satisfied_requests);
-
- if (props_out != NULL)
- *props_out = request_properties;
- else
- g_hash_table_unref (request_properties);
+ return satisfied_requests;
}
static void
@@ -1988,8 +1970,8 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self)
McdClientProxy *client = MCD_CLIENT_PROXY (client_p);
gboolean observed = FALSE;
const gchar *account_path, *connection_path, *chan_path;
- GPtrArray *satisfied_requests;
- GHashTable *request_properties, *chan_props;
+ GHashTable *satisfied_requests;
+ GHashTable *chan_props;
if (!tp_proxy_has_interface_by_id (client,
TP_IFACE_QUARK_CLIENT_OBSERVER))
@@ -2021,14 +2003,7 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self)
chan_path = mcd_channel_get_object_path (self->priv->channel);
chan_props = mcd_channel_dup_immutable_properties_asv (self->priv->channel);
- collect_satisfied_requests (self->priv->channel, &satisfied_requests,
- &request_properties);
-
- /* transfer ownership into observer_info */
- tp_asv_take_boxed (observer_info, "request-properties",
- TP_HASH_TYPE_OBJECT_IMMUTABLE_PROPERTIES_MAP,
- request_properties);
- request_properties = NULL;
+ satisfied_requests = collect_satisfied_requests (self->priv->channel);
if (_mcd_dispatch_operation_needs_approval (self))
{
@@ -2039,6 +2014,7 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self)
DEBUG ("calling ObserveChannel on %s for CDO %p",
tp_proxy_get_bus_name (client), self);
+
tp_cli_client_observer_call_observe_channel (
(TpClient *) client, -1,
account_path, connection_path, chan_path, chan_props,
@@ -2046,7 +2022,7 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self)
observe_channels_cb,
g_object_ref (self), g_object_unref, NULL);
- g_ptr_array_unref (satisfied_requests);
+ g_hash_table_unref (satisfied_requests);
g_hash_table_unref (chan_props);
}
@@ -2217,7 +2193,6 @@ static void
mcd_dispatch_operation_handle_channels (McdDispatchOperation *self)
{
GHashTable *handler_info;
- GHashTable *request_properties;
g_assert (self->priv->trying_handler != NULL);
g_return_if_fail (self->priv->channel != NULL);
@@ -2239,13 +2214,7 @@ mcd_dispatch_operation_handle_channels (McdDispatchOperation *self)
return;
}
- collect_satisfied_requests (self->priv->channel, NULL,
- &request_properties);
-
handler_info = tp_asv_new (NULL, NULL);
- tp_asv_take_boxed (handler_info, "request-properties",
- TP_HASH_TYPE_OBJECT_IMMUTABLE_PROPERTIES_MAP, request_properties);
- request_properties = NULL;
_mcd_client_proxy_handle_channel (self->priv->trying_handler,
-1, self->priv->channel, self->priv->handle_with_time,
diff --git a/tests/twisted/account-requests/create-text.py b/tests/twisted/account-requests/create-text.py
index a79299d2..7337ab34 100644
--- a/tests/twisted/account-requests/create-text.py
+++ b/tests/twisted/account-requests/create-text.py
@@ -141,7 +141,7 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[2] == channel.object_path, e.args.object_path
assert e.args[3] == channel_immutable, e.args
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[5])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -155,7 +155,7 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
# Handler accepts the Channels
q.dbus_return(e.message, signature='')
diff --git a/tests/twisted/dispatcher/already-has-channel.py b/tests/twisted/dispatcher/already-has-channel.py
index 211da3d2..6f5e6694 100644
--- a/tests/twisted/dispatcher/already-has-channel.py
+++ b/tests/twisted/dispatcher/already-has-channel.py
@@ -25,7 +25,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
+ call_async, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, SimulatedChannel, expect_client_setup
import constants as cs
@@ -151,7 +151,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, chan.object_path
assert e.args[3] == channel_properties, channel_properties
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
diff --git a/tests/twisted/dispatcher/approver-fails.py b/tests/twisted/dispatcher/approver-fails.py
index a09ddf91..1b7dc0f6 100644
--- a/tests/twisted/dispatcher/approver-fails.py
+++ b/tests/twisted/dispatcher/approver-fails.py
@@ -115,7 +115,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, chan.object_path
assert e.args[3] == channel_properties, channel_properties
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
q.dbus_return(e.message, bus=empathy_bus, signature='')
diff --git a/tests/twisted/dispatcher/bypass-approval.py b/tests/twisted/dispatcher/bypass-approval.py
index 97a9c6ab..149cd7a2 100644
--- a/tests/twisted/dispatcher/bypass-approval.py
+++ b/tests/twisted/dispatcher/bypass-approval.py
@@ -121,7 +121,7 @@ def announce_common(q, bus, empathy, kopete, account, conn, cd_props,
assert e.args[2] == chan.object_path, chan.object_path
assert e.args[3] == channel_properties, channel_properties
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
diff --git a/tests/twisted/dispatcher/capture-bundle.py b/tests/twisted/dispatcher/capture-bundle.py
index dc4b034a..d9a39e54 100644
--- a/tests/twisted/dispatcher/capture-bundle.py
+++ b/tests/twisted/dispatcher/capture-bundle.py
@@ -25,7 +25,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
+ call_async, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
expect_client_setup
@@ -130,7 +130,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, chan.object_path
assert e.args[3] == channel_properties, channel_properties
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
@@ -258,7 +258,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, chan.object_path
assert e.args[3] == channel_properties, channel_properties
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
diff --git a/tests/twisted/dispatcher/create-at-startup.py b/tests/twisted/dispatcher/create-at-startup.py
index b74d6ddc..5eb7408e 100644
--- a/tests/twisted/dispatcher/create-at-startup.py
+++ b/tests/twisted/dispatcher/create-at-startup.py
@@ -26,7 +26,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
+ call_async, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
SimulatedConnectionManager, SimulatedChannel, \
expect_client_setup, MC
@@ -179,7 +179,7 @@ def test(q, bus, unused, **kwargs):
assert a.args[2] == announcement.object_path, channels
assert a.args[3] == announcement_immutable, channels
assert a.args[4] != '/', a.args # there is a dispatch operation
- assert a.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, a.args[5]) # no requests satisfied
# Time passes. A channel is returned.
@@ -222,7 +222,7 @@ def test(q, bus, unused, **kwargs):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals([request_path], e.args[4].keys())
assert e.args[5] == user_action_time
assert isinstance(e.args[6], dict)
assert len(e.args) == 7
diff --git a/tests/twisted/dispatcher/create-handler-fails.py b/tests/twisted/dispatcher/create-handler-fails.py
index ac8e00ea..a24eecf0 100644
--- a/tests/twisted/dispatcher/create-handler-fails.py
+++ b/tests/twisted/dispatcher/create-handler-fails.py
@@ -25,7 +25,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
+ call_async, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
expect_client_setup
@@ -146,7 +146,7 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[2] == channel.object_path, channel.object_path
assert e.args[3] == channel_immutable, channel_immutable
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[5])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -160,7 +160,7 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
assert isinstance(e.args[6], dict)
assert len(e.args) == 7
diff --git a/tests/twisted/dispatcher/create-hints.py b/tests/twisted/dispatcher/create-hints.py
index 6c2b9f42..a89e9dbc 100644
--- a/tests/twisted/dispatcher/create-hints.py
+++ b/tests/twisted/dispatcher/create-hints.py
@@ -148,9 +148,8 @@ def test_channel_creation(q, bus, account, client, conn,
assert e.args[2] == channel.object_path, channel.object_path
assert e.args[3] == channel_immutable, channel_immutable
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args # no requests satisfied
- info = e.args[6]
- assert info['request-properties'] == {request_path: request_props}, info
+ assertEquals({ request_path: request_props }, e.args[5])
+ assertEquals({}, e.args[6])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -164,9 +163,9 @@ def test_channel_creation(q, bus, account, client, conn,
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
- assert isinstance(e.args[6], dict)
+ assertEquals({}, e.args[6])
assert len(e.args) == 7
# Handler accepts the Channels
diff --git a/tests/twisted/dispatcher/create-no-preferred-handler.py b/tests/twisted/dispatcher/create-no-preferred-handler.py
index 954d95f7..ad017e35 100644
--- a/tests/twisted/dispatcher/create-no-preferred-handler.py
+++ b/tests/twisted/dispatcher/create-no-preferred-handler.py
@@ -25,7 +25,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async
+ call_async, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
expect_client_setup
@@ -152,7 +152,7 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[2] == channel.object_path, channel.object_path
assert e.args[3] == channel_immutable, channel_immutable
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[5])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -166,9 +166,9 @@ def test_channel_creation(q, bus, account, client, conn, ensure):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
- assert isinstance(e.args[6], dict)
+ assertEquals({}, e.args[6])
assert len(e.args) == 7
# Handler accepts the Channels
diff --git a/tests/twisted/dispatcher/create-text.py b/tests/twisted/dispatcher/create-text.py
index 56923e6e..baae37f1 100644
--- a/tests/twisted/dispatcher/create-text.py
+++ b/tests/twisted/dispatcher/create-text.py
@@ -167,8 +167,7 @@ def test_channel_creation(q, bus, account, client, conn,
assert e.args[2] == channel.object_path, channel.object_path
assert e.args[3] == channel_immutable, channel_immutable
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args
-
+ assertEquals({ request_path: request_props }, e.args[5])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -182,13 +181,9 @@ def test_channel_creation(q, bus, account, client, conn,
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
assert isinstance(e.args[6], dict)
- assertContains('request-properties', e.args[6])
- assertContains(request_path, e.args[6]['request-properties'])
- assertLength(1, e.args[6]['request-properties'])
- assertEquals(request_props, e.args[6]['request-properties'][request_path])
assert len(e.args) == 7
# Handler accepts the Channels
diff --git a/tests/twisted/dispatcher/created-behind-our-back.py b/tests/twisted/dispatcher/created-behind-our-back.py
index d768c099..8109e675 100644
--- a/tests/twisted/dispatcher/created-behind-our-back.py
+++ b/tests/twisted/dispatcher/created-behind-our-back.py
@@ -22,7 +22,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async, sync_dbus
+ call_async, sync_dbus, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
expect_client_setup
@@ -90,7 +90,7 @@ def test(q, bus, mc):
assert e.args[2] == channel.object_path, channel.object_path
assert e.args[3] == channel_immutable, channel_immutable
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert e.args == k.args
diff --git a/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py b/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
index c4d4d687..e7836ec7 100644
--- a/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
+++ b/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
@@ -24,7 +24,7 @@ import dbus
import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
- call_async, sync_dbus
+ call_async, sync_dbus, assertEquals
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
expect_client_setup
@@ -322,7 +322,7 @@ def test(q, bus, mc):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == chan.object_path, channels
assert e.args[3] == chan.immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals([request_path], e.args[4].keys())
assert e.args[5] == user_action_time, (e.args[4], user_action_time)
assert isinstance(e.args[6], dict)
assert len(e.args) == 7
diff --git a/tests/twisted/dispatcher/dispatch-text.py b/tests/twisted/dispatcher/dispatch-text.py
index c0261410..b8a008c5 100644
--- a/tests/twisted/dispatcher/dispatch-text.py
+++ b/tests/twisted/dispatcher/dispatch-text.py
@@ -132,7 +132,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
@@ -261,7 +261,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
@@ -382,7 +382,7 @@ def test(q, bus, mc):
assert e.args[2] == claimed_chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
diff --git a/tests/twisted/dispatcher/ensure-and-redispatch.py b/tests/twisted/dispatcher/ensure-and-redispatch.py
index 38a05edb..36261572 100644
--- a/tests/twisted/dispatcher/ensure-and-redispatch.py
+++ b/tests/twisted/dispatcher/ensure-and-redispatch.py
@@ -170,7 +170,7 @@ def test_channel_creation(q, bus, account, client, conn):
assert e.args[2] == channel.object_path, e.args
assert e.args[3] == channel_immutable, e.args
assert e.args[4] == '/', e.args # no dispatch operation
- assert e.args[5] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[5])
# Observer says "OK, go"
q.dbus_return(e.message, signature='')
@@ -184,7 +184,7 @@ def test_channel_creation(q, bus, account, client, conn):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
assert isinstance(e.args[6], dict)
assert len(e.args) == 7
@@ -295,7 +295,7 @@ def test_channel_redispatch(q, bus, account, client, conn, channel,
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel.immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals({ request_path: request_props }, e.args[4])
assert e.args[5] == user_action_time
assert isinstance(e.args[6], dict)
assertContains('request-properties', e.args[6])
diff --git a/tests/twisted/dispatcher/ensure-is-approval.py b/tests/twisted/dispatcher/ensure-is-approval.py
index d4945ff1..c8a3af93 100644
--- a/tests/twisted/dispatcher/ensure-is-approval.py
+++ b/tests/twisted/dispatcher/ensure-is-approval.py
@@ -140,7 +140,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
@@ -235,7 +235,7 @@ def test(q, bus, mc):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == chan.object_path, channels
assert e.args[3] == chan.immutable, channels
- assert e.args[4] == [request_path], e.args
+ assertEquals([request_path], e.args[4].keys())
assert e.args[5] == user_action_time, (e.args[4], user_action_time)
assert isinstance(e.args[6], dict)
assert len(e.args) == 7
diff --git a/tests/twisted/dispatcher/ensure-rapidly.py b/tests/twisted/dispatcher/ensure-rapidly.py
index f2909ff3..d33b2657 100644
--- a/tests/twisted/dispatcher/ensure-rapidly.py
+++ b/tests/twisted/dispatcher/ensure-rapidly.py
@@ -207,18 +207,10 @@ def test_channel_creation(q, bus, account, client, conn,
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == channel.object_path, channels
assert e.args[3] == channel_immutable, channels
+ assertEquals({ cr1.object_path: request_props1, cr2.object_path: request_props2 }, e.args[4])
assert sorted(e.args[4]) == sorted([cr1.object_path,
cr2.object_path]), e.args
assert e.args[5] == user_action_time2, (e.args[4], user_action_time2)
- assert isinstance(e.args[6], dict)
- assertContains('request-properties', e.args[6])
- assertContains(cr1.object_path, e.args[6]['request-properties'])
- assertContains(cr2.object_path, e.args[6]['request-properties'])
- assertLength(2, e.args[6]['request-properties'])
- assertEquals(request_props1,
- e.args[6]['request-properties'][cr1.object_path])
- assertEquals(request_props2,
- e.args[6]['request-properties'][cr2.object_path])
assert len(e.args) == 7
# Handler accepts the Channels
diff --git a/tests/twisted/dispatcher/exploding-bundles.py b/tests/twisted/dispatcher/exploding-bundles.py
index 9fb7e240..8c0bd058 100644
--- a/tests/twisted/dispatcher/exploding-bundles.py
+++ b/tests/twisted/dispatcher/exploding-bundles.py
@@ -148,7 +148,7 @@ def test(q, bus, mc):
assert e_observe_text.args[2] == text_chan.object_path, e_observe_text.args
assert e_observe_text.args[3] == text_channel_properties, e_observe_text.args
assert e_observe_text.args[4] == text_cdo_path, e_observe_text.args
- assert e_observe_text.args[5] == [], e_observe_text.args
+ assert e_observe_text.args[5] == {}, e_observe_text.args
assert k_observe_text.args[0] == e_observe_text.args[0], k_observe_text.args
assert k_observe_text.args[1] == e_observe_text.args[1], k_observe_text.args
@@ -208,7 +208,7 @@ def test(q, bus, mc):
assert e_observe_media.args[2] == media_chan.object_path, e_observe_media.args
assert e_observe_media.args[3] == media_channel_properties, e_observe_media.args
assert e_observe_media.args[4] == media_cdo_path, e_observe_media.args
- assert e_observe_media.args[5] == [], e_observe_media.args
+ assert e_observe_media.args[5] == {}, e_observe_media.args
e_approve_media = q.expect('dbus-method-call',
path=empathy.object_path,
diff --git a/tests/twisted/dispatcher/handle-channels-fails.py b/tests/twisted/dispatcher/handle-channels-fails.py
index 3b8e1597..771a11a2 100644
--- a/tests/twisted/dispatcher/handle-channels-fails.py
+++ b/tests/twisted/dispatcher/handle-channels-fails.py
@@ -128,7 +128,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
q.dbus_return(e.message, bus=empathy_bus, signature='')
diff --git a/tests/twisted/dispatcher/recover-from-disconnect.py b/tests/twisted/dispatcher/recover-from-disconnect.py
index 21420bfd..86baa10f 100644
--- a/tests/twisted/dispatcher/recover-from-disconnect.py
+++ b/tests/twisted/dispatcher/recover-from-disconnect.py
@@ -211,7 +211,7 @@ def test_dispatching(q, bus, conn, account, empathy, kopete):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert k.args == e.args
diff --git a/tests/twisted/dispatcher/respawn-activatable-observers.py b/tests/twisted/dispatcher/respawn-activatable-observers.py
index 2db7c8c7..45005cca 100644
--- a/tests/twisted/dispatcher/respawn-activatable-observers.py
+++ b/tests/twisted/dispatcher/respawn-activatable-observers.py
@@ -146,7 +146,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
# Logger indicates that it is ready to proceed
q.dbus_return(e.message, bus=logger_bus, signature='')
@@ -218,7 +218,7 @@ def test(q, bus, mc):
assert e.args[1] == conn.object_path, e.args
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
assert e.args[6]['recovering'] == 1, e.args # due to observer recovery
# Logger indicates that it is ready to proceed
diff --git a/tests/twisted/dispatcher/respawn-observers.py b/tests/twisted/dispatcher/respawn-observers.py
index a766a596..76bb3d4f 100644
--- a/tests/twisted/dispatcher/respawn-observers.py
+++ b/tests/twisted/dispatcher/respawn-observers.py
@@ -130,7 +130,7 @@ def test(q, bus, mc):
assert e.args[2] == chan.object_path, e.args
assert e.args[3] == channel_properties, e.args
assert e.args[4] == cdo_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
# Empathy indicates that it is ready to proceed
q.dbus_return(e.message, bus=empathy_bus, signature='')
@@ -232,7 +232,7 @@ def test(q, bus, mc):
assert e.args[2] == chan2.object_path, e.args
assert e.args[3] == channel2_properties, e.args
assert e.args[4] == cdo2_path, e.args
- assert e.args[5] == [], e.args # no requests satisfied
+ assertEquals({}, e.args[5]) # no requests satisfied
# Empathy indicates that it is ready to proceed
q.dbus_return(e.message, bus=empathy_bus, signature='')
@@ -287,14 +287,14 @@ def test(q, bus, mc):
assert e1.args[1] == conn.object_path, e1.args
assert e1.args[2] == chan.object_path, e1.args
assert e1.args[3] == channel_properties, e1.args
- assert e1.args[5] == [], e1.args # no requests satisfied
+ assertEquals({}, e1.args[5]) # no requests satisfied
assert e1.args[6]['recovering'] == 1, e1.args # due to observer recovery
assert e2.args[0] == account.object_path, e2.args
assert e2.args[1] == conn.object_path, e2.args
assert e2.args[2] == chan2.object_path, e1.args
assert e2.args[3] == channel2_properties, e1.args
- assert e2.args[5] == [], e2.args # no requests satisfied
+ assertEquals({}, e2.args[5]) # no requests satisfied
assert e2.args[6]['recovering'] == 1, e2.args # due to observer recovery
# Empathy indicates that it is ready to proceed