summaryrefslogtreecommitdiff
path: root/tests/dbus/protocol-objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dbus/protocol-objects.c')
-rw-r--r--tests/dbus/protocol-objects.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/dbus/protocol-objects.c b/tests/dbus/protocol-objects.c
index 248805728..fee4afe4b 100644
--- a/tests/dbus/protocol-objects.c
+++ b/tests/dbus/protocol-objects.c
@@ -567,6 +567,62 @@ test_normalize (Test *test,
g_clear_error (&test->error);
}
+static void
+test_id (Test *test,
+ gconstpointer data G_GNUC_UNUSED)
+{
+ GAsyncResult *result = NULL;
+ gchar *s;
+
+ tp_tests_proxy_run_until_prepared (test->cm, NULL);
+ test->protocol = g_object_ref (
+ tp_connection_manager_get_protocol_object (test->cm, "example"));
+
+ tp_protocol_identify_account_async (test->protocol,
+ g_variant_new_parsed ("{ 'account': <'Hello'> }"),
+ NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_identify_account_finish (test->protocol, result,
+ &test->error);
+ g_assert_no_error (test->error);
+ g_assert_cmpstr (s, ==, "hello");
+ g_clear_object (&result);
+ g_free (s);
+
+ tp_protocol_identify_account_async (test->protocol,
+ g_variant_new_parsed ("{ 'account': <'Hello'>, 'unknown-param': <42> }"),
+ NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_identify_account_finish (test->protocol, result,
+ &test->error);
+ g_assert_error (test->error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT);
+ g_assert_cmpstr (s, ==, NULL);
+ g_clear_object (&result);
+ g_clear_error (&test->error);
+
+ tp_protocol_identify_account_async (test->protocol,
+ g_variant_new_parsed ("@a{sv} {}"),
+ NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_identify_account_finish (test->protocol, result,
+ &test->error);
+ g_assert_error (test->error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT);
+ g_assert_cmpstr (s, ==, NULL);
+ g_clear_object (&result);
+ g_clear_error (&test->error);
+
+ tp_protocol_identify_account_async (test->protocol,
+ g_variant_new_parsed ("@a{sv} { 'account': <''> }"),
+ NULL, tp_tests_result_ready_cb, &result);
+ tp_tests_run_until_result (&result);
+ s = tp_protocol_identify_account_finish (test->protocol, result,
+ &test->error);
+ g_assert_error (test->error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT);
+ g_assert_cmpstr (s, ==, NULL);
+ g_clear_object (&result);
+ g_clear_error (&test->error);
+}
+
int
main (int argc,
char **argv)
@@ -592,6 +648,8 @@ main (int argc,
test_protocol_object_from_file, teardown);
g_test_add ("/protocol-objects/normalize", Test, NULL, setup,
test_normalize, teardown);
+ g_test_add ("/protocol-objects/id", Test, NULL, setup,
+ test_id, teardown);
return tp_tests_run_with_bus ();
}