summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-12 15:51:44 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-29 19:28:29 +0000
commit21ab80884868a065772297d31f8ce8ba0d30bb7b (patch)
tree5994ad7c6799c500067536d0aaac1c5c2101ba11 /tests
parent4db6783e78972a35a1f66ed0311cf8080a1b63e1 (diff)
McpAccountStorage: merge commit and commit_one into one function
Based on part of a patch by Xavier Claessens. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71384 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/dbus-account-plugin.c16
-rw-r--r--tests/twisted/mcp-account-diversion.c6
2 files changed, 13 insertions, 9 deletions
diff --git a/tests/twisted/dbus-account-plugin.c b/tests/twisted/dbus-account-plugin.c
index c81bce48..0e94b9b3 100644
--- a/tests/twisted/dbus-account-plugin.c
+++ b/tests/twisted/dbus-account-plugin.c
@@ -1174,7 +1174,7 @@ test_dbus_account_plugin_set_parameter (McpAccountStorage *storage,
}
static gboolean
-test_dbus_account_plugin_commit (const McpAccountStorage *storage,
+test_dbus_account_plugin_commit_all (const McpAccountStorage *storage,
const McpAccountManager *am)
{
TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage);
@@ -1194,7 +1194,7 @@ test_dbus_account_plugin_commit (const McpAccountStorage *storage,
while (g_hash_table_iter_next (&iter, &k, NULL))
{
- if (!mcp_account_storage_commit_one (storage, am, k))
+ if (!mcp_account_storage_commit (storage, am, k))
{
g_warning ("declined to commit account %s", (const gchar *) k);
}
@@ -1334,12 +1334,12 @@ update_parameters_cb (GObject *source_object,
}
static gboolean
-test_dbus_account_plugin_commit_one (const McpAccountStorage *storage,
+test_dbus_account_plugin_commit (const McpAccountStorage *storage,
const McpAccountManager *am,
const gchar *account_name)
{
TestDBusAccountPlugin *self = TEST_DBUS_ACCOUNT_PLUGIN (storage);
- Account *account = lookup_account (self, account_name);
+ Account *account;
GHashTableIter iter;
gpointer k;
GVariantBuilder a_sv_builder;
@@ -1349,9 +1349,10 @@ test_dbus_account_plugin_commit_one (const McpAccountStorage *storage,
DEBUG ("%s", account_name);
- /* MC does not call @commit_one with parameter %NULL (meaning "all accounts")
- * if we also implement commit(), which, as it happens, we do */
- g_return_val_if_fail (account_name != NULL, FALSE);
+ if (account_name == NULL)
+ return test_dbus_account_plugin_commit_all (storage, am);
+
+ account = lookup_account (self, account_name);
if (!self->active || account == NULL)
return FALSE;
@@ -1591,7 +1592,6 @@ account_storage_iface_init (McpAccountStorageIface *iface)
iface->ready = test_dbus_account_plugin_ready;
iface->delete = test_dbus_account_plugin_delete;
iface->commit = test_dbus_account_plugin_commit;
- iface->commit_one = test_dbus_account_plugin_commit_one;
iface->get_identifier = test_dbus_account_plugin_get_identifier;
iface->get_additional_info = test_dbus_account_plugin_get_additional_info;
iface->get_restrictions = test_dbus_account_plugin_get_restrictions;
diff --git a/tests/twisted/mcp-account-diversion.c b/tests/twisted/mcp-account-diversion.c
index 923f51b4..e36b1ac5 100644
--- a/tests/twisted/mcp-account-diversion.c
+++ b/tests/twisted/mcp-account-diversion.c
@@ -207,13 +207,17 @@ _delete (const McpAccountStorage *self,
static gboolean
_commit (const McpAccountStorage *self,
- const McpAccountManager *am)
+ const McpAccountManager *am,
+ const gchar *account_name G_GNUC_UNUSED)
{
gsize n;
gchar *data;
AccountDiversionPlugin *adp = ACCOUNT_DIVERSION_PLUGIN (self);
gboolean rval = FALSE;
+ /* This simple implementation ignores account_name and commits everything:
+ * we're writing out the whole keyfile anyway */
+
if (!adp->save)
return TRUE;