Sun, 14 Apr 2024 01:14:59 -0500
Remove PurpleBuddy
PurpleContactInfo was created long ago to replace this, it is now its time!
Testing Done:
Ran the turtles.
Reviewed at https://reviews.imfreedom.org/r/3123/
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
40651
8737840a09b7
Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
8737840a09b7
Fix some file headers for the credential provider api
Gary Kramlich <grim@reaperworld.com>
parents:
40583
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This library is free software; you can redistribute it and/or |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * modify it under the terms of the GNU Lesser General Public |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * License as published by the Free Software Foundation; either |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * version 2 of the License, or (at your option) any later version. |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This library is distributed in the hope that it will be useful, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * Lesser General Public License for more details. |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU Lesser General Public |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #include <glib.h> |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #include <purple.h> |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #include "test_ui.h" |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | * Globals |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | /* Since we're using GTask to test asynchrous functions, we need to use a main |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | * loop. |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | */ |
|
40583
28964322556c
Add the new PurpleCredentialManager API
Gary Kramlich <grim@reaperworld.com>
parents:
40561
diff
changeset
|
32 | static GMainLoop *loop = NULL; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | * TestCredentialProviderEmpty |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | G_DECLARE_FINAL_TYPE(TestPurpleCredentialProviderEmpty, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | test_purple_credential_provider_empty, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | TEST_PURPLE, CREDENTIAL_PROVIDER_EMPTY, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | PurpleCredentialProvider) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | struct _TestPurpleCredentialProviderEmpty { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | PurpleCredentialProvider parent; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | }; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
42576
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
46 | G_DEFINE_FINAL_TYPE(TestPurpleCredentialProviderEmpty, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
47 | test_purple_credential_provider_empty, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
48 | PURPLE_TYPE_CREDENTIAL_PROVIDER) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
51 | test_purple_credential_provider_empty_read_password_async(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
52 | G_GNUC_UNUSED PurpleAccount *account, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
53 | G_GNUC_UNUSED GCancellable *cancellable, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
54 | G_GNUC_UNUSED GAsyncReadyCallback callback, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
55 | G_GNUC_UNUSED gpointer data) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | static gchar * |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
60 | test_purple_credential_provider_empty_read_password_finish(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
61 | G_GNUC_UNUSED GAsyncResult *result, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
62 | G_GNUC_UNUSED GError **error) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | return NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
68 | test_purple_credential_provider_empty_write_password_async(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
69 | G_GNUC_UNUSED PurpleAccount *account, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
70 | G_GNUC_UNUSED const gchar *password, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
71 | G_GNUC_UNUSED GCancellable *cancellable, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
72 | G_GNUC_UNUSED GAsyncReadyCallback callback, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
73 | G_GNUC_UNUSED gpointer data) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | static gboolean |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
78 | test_purple_credential_provider_empty_write_password_finish(G_GNUC_UNUSED PurpleCredentialProvider *provider, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
79 | G_GNUC_UNUSED GAsyncResult *result, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
80 | G_GNUC_UNUSED GError **error) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | return TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
86 | test_purple_credential_provider_empty_class_init(G_GNUC_UNUSED TestPurpleCredentialProviderEmptyClass *klass) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
91 | test_purple_credential_provider_empty_init(G_GNUC_UNUSED TestPurpleCredentialProviderEmpty *provider) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | * purple_credential_provider_is_valid tests |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | test_purple_credential_provider_is_valid_no_id(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | PurpleCredentialProvider *provider = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | GError *error = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | provider = g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
104 | test_purple_credential_provider_empty_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | "name", "name", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | g_assert_false(purple_credential_provider_is_valid(provider, &error)); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 0); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | g_clear_error(&error); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
112 | g_object_unref(provider); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | test_purple_credential_provider_is_valid_no_name(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | PurpleCredentialProvider *provider = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | GError *error = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | provider = g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
121 | test_purple_credential_provider_empty_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | "id", "id", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | g_assert_false(purple_credential_provider_is_valid(provider, &error)); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 1); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | g_clear_error(&error); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
129 | g_object_unref(provider); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | test_purple_credential_provider_is_valid_no_reader(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | PurpleCredentialProvider *provider = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | PurpleCredentialProviderClass *klass = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | GError *error = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | provider = g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
139 | test_purple_credential_provider_empty_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | "id", "id", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | "name", "name", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | klass->read_password_async = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
146 | klass->read_password_finish = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
147 | klass->write_password_async = test_purple_credential_provider_empty_write_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | klass->write_password_finish = test_purple_credential_provider_empty_write_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
149 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
150 | g_assert_false(purple_credential_provider_is_valid(provider, &error)); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 | g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 2); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | g_clear_error(&error); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
154 | g_object_unref(provider); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
155 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
156 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | test_purple_credential_provider_is_valid_no_writer(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | PurpleCredentialProvider *provider = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | PurpleCredentialProviderClass *klass = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 | GError *error = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
162 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | provider = g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
164 | test_purple_credential_provider_empty_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
165 | "id", "id", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | "name", "name", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
169 | klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | klass->read_password_async = test_purple_credential_provider_empty_read_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | klass->read_password_finish = test_purple_credential_provider_empty_read_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | klass->write_password_async = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | klass->write_password_finish = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | g_assert_false(purple_credential_provider_is_valid(provider, &error)); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 3); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | g_clear_error(&error); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
179 | g_object_unref(provider); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | test_purple_credential_provider_is_valid_valid(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | PurpleCredentialProvider *provider = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | PurpleCredentialProviderClass *klass = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | GError *error = NULL; |
|
40685
bdeaceebb0bd
When testing make sure we don't have an error before we check return values.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
187 | gboolean ret = FALSE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
189 | provider = g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
190 | test_purple_credential_provider_empty_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | "id", "id", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 | "name", "name", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | klass = PURPLE_CREDENTIAL_PROVIDER_GET_CLASS(provider); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 | klass->read_password_async = test_purple_credential_provider_empty_read_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
197 | klass->read_password_finish = test_purple_credential_provider_empty_read_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
198 | klass->write_password_async = test_purple_credential_provider_empty_write_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | klass->write_password_finish = test_purple_credential_provider_empty_write_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | |
|
40685
bdeaceebb0bd
When testing make sure we don't have an error before we check return values.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
201 | ret = purple_credential_provider_is_valid(provider, &error); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | g_assert_no_error(error); |
|
40685
bdeaceebb0bd
When testing make sure we don't have an error before we check return values.
Gary Kramlich <grim@reaperworld.com>
parents:
40679
diff
changeset
|
203 | g_assert_true(ret); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
205 | g_object_unref(provider); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
206 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
207 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
208 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
209 | * TestPurpleCredentialProvider |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | G_DECLARE_FINAL_TYPE(TestPurpleCredentialProvider, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | test_purple_credential_provider, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | TEST_PURPLE, CREDENTIAL_PROVIDER, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | PurpleCredentialProvider) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | struct _TestPurpleCredentialProvider { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | PurpleCredentialProvider parent; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | gboolean read_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | gboolean read_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | gboolean write_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | gboolean write_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
223 | gboolean clear_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
224 | gboolean clear_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
225 | }; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
226 | |
|
42576
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
227 | G_DEFINE_FINAL_TYPE(TestPurpleCredentialProvider, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
228 | test_purple_credential_provider, |
|
ab1ca778ddb2
Make sure all of the final types in libpurple are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42241
diff
changeset
|
229 | PURPLE_TYPE_CREDENTIAL_PROVIDER) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | test_purple_credential_provider_read_password_async(PurpleCredentialProvider *p, |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
233 | G_GNUC_UNUSED PurpleAccount *account, |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 | GCancellable *cancellable, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 | GAsyncReadyCallback callback, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | gpointer data) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
237 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
238 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | GTask *task = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | provider->read_password_async = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
243 | task = g_task_new(p, cancellable, callback, data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
244 | g_task_return_pointer(task, NULL, NULL); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
245 | g_object_unref(task); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 | static gchar * |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | test_purple_credential_provider_read_password_finish(PurpleCredentialProvider *p, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
250 | GAsyncResult *result, |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
251 | GError **error) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | provider->read_password_finish = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
257 | return g_task_propagate_pointer(G_TASK(result), error); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | test_purple_credential_provider_write_password_async(PurpleCredentialProvider *p, |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
262 | G_GNUC_UNUSED PurpleAccount *account, |
|
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
263 | G_GNUC_UNUSED const gchar *password, |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | GCancellable *cancellable, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
265 | GAsyncReadyCallback callback, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
266 | gpointer data) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
267 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
268 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
269 | GTask *task = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
270 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
271 | provider->write_password_async = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
272 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | task = g_task_new(p, cancellable, callback, data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | g_task_return_boolean(task, TRUE); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
275 | g_object_unref(task); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
276 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
277 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
278 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | test_purple_credential_provider_write_password_finish(PurpleCredentialProvider *p, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
280 | GAsyncResult *result, |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
281 | GError **error) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
283 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
284 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | provider->write_password_finish = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
287 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | test_purple_credential_provider_clear_password_async(PurpleCredentialProvider *p, |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
292 | G_GNUC_UNUSED PurpleAccount *account, |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
293 | GCancellable *cancellable, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | GAsyncReadyCallback callback, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | gpointer data) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
296 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
297 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | GTask *task = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
300 | provider->clear_password_async = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
301 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
302 | task = g_task_new(p, cancellable, callback, data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
303 | g_task_return_boolean(task, TRUE); |
|
42592
6b65c0e4ba15
Remove unnecessary casts for GObject methods
Gary Kramlich <grim@reaperworld.com>
parents:
42576
diff
changeset
|
304 | g_object_unref(task); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
305 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
306 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
307 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
308 | test_purple_credential_provider_clear_password_finish(PurpleCredentialProvider *p, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
309 | GAsyncResult *result, |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
310 | GError **error) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
311 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
312 | TestPurpleCredentialProvider *provider = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
313 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
314 | provider->clear_password_finish = TRUE; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
315 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
316 | return g_task_propagate_boolean(G_TASK(result), error); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
317 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
318 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
319 | static void |
|
42089
083eae91c9a8
Update the libpurple tests for the warning level 2 update
Gary Kramlich <grim@reaperworld.com>
parents:
41982
diff
changeset
|
320 | test_purple_credential_provider_init(G_GNUC_UNUSED TestPurpleCredentialProvider *provider) { |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
321 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
322 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
323 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
324 | test_purple_credential_provider_class_init(TestPurpleCredentialProviderClass *klass) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
325 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
326 | PurpleCredentialProviderClass *provider_class = PURPLE_CREDENTIAL_PROVIDER_CLASS(klass); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
327 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
328 | provider_class->read_password_async = test_purple_credential_provider_read_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
329 | provider_class->read_password_finish = test_purple_credential_provider_read_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
330 | provider_class->write_password_async = test_purple_credential_provider_write_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
331 | provider_class->write_password_finish = test_purple_credential_provider_write_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
332 | provider_class->clear_password_async = test_purple_credential_provider_clear_password_async; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
333 | provider_class->clear_password_finish = test_purple_credential_provider_clear_password_finish; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
334 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
335 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
336 | static PurpleCredentialProvider * |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
337 | test_purple_credential_provider_new(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
338 | return g_object_new( |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
339 | test_purple_credential_provider_get_type(), |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
340 | "id", "test-provider", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
341 | "name", "Test Provider", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
342 | NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
343 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
344 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
345 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
346 | * TestPurpleCredentialProvider Tests |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
347 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
348 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
349 | test_purple_credential_provider_timeout_cb(gpointer data) { |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
350 | g_main_loop_quit(data); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
351 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
352 | g_warning("timed out waiting for the callback function to be called"); |
|
40561
569ab1326932
Fix a few issues with the CredentialProvider code that snuck past review
Gary Kramlich <grim@reaperworld.com>
parents:
40548
diff
changeset
|
353 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
354 | return G_SOURCE_REMOVE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
355 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
356 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
357 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
358 | test_purple_credential_provider_test_read_cb(GObject *obj, GAsyncResult *res, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
359 | gpointer data) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
360 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
361 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
362 | PurpleAccount *account = data; |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
363 | GError *error = NULL; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
364 | gchar *password = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
365 | |
|
40679
062a4574af3e
Remove the account parameter from purple_credential_provider_*_finish functions.
Gary Kramlich <grim@reaperworld.com>
parents:
40651
diff
changeset
|
366 | password = purple_credential_provider_read_password_finish(provider, res, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
367 | &error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
368 | g_assert_no_error(error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
369 | g_assert_null(password); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
370 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
371 | g_clear_object(&account); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
372 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
373 | g_main_loop_quit(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
374 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
375 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
376 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
377 | test_purple_credential_provider_test_read_idle(gpointer data) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
378 | PurpleCredentialProvider *p = PURPLE_CREDENTIAL_PROVIDER(data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
379 | PurpleAccount *account = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
380 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
381 | account = purple_account_new("test", "test"); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
382 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
383 | purple_credential_provider_read_password_async(p, account, NULL, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
384 | test_purple_credential_provider_test_read_cb, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
385 | account); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
386 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
387 | return G_SOURCE_REMOVE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
388 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
389 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
390 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
391 | test_purple_credential_provider_test_read(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
392 | PurpleCredentialProvider *p = test_purple_credential_provider_new(); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
393 | TestPurpleCredentialProvider *tp = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
394 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
395 | g_idle_add(test_purple_credential_provider_test_read_idle, p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
396 | g_timeout_add_seconds(10, test_purple_credential_provider_timeout_cb, loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
397 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
398 | g_main_loop_run(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
399 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
400 | g_assert_true(tp->read_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
401 | g_assert_true(tp->read_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
402 | g_assert_false(tp->write_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
403 | g_assert_false(tp->write_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
404 | g_assert_false(tp->clear_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
405 | g_assert_false(tp->clear_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
406 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
407 | g_clear_object(&p); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
408 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
409 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
410 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
411 | test_purple_credential_provider_test_write_cb(GObject *obj, GAsyncResult *res, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
412 | gpointer d) |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
413 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
414 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
415 | PurpleAccount *account = PURPLE_ACCOUNT(d); |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
416 | GError *error = NULL; |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
417 | gboolean ret = FALSE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
418 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
419 | ret = purple_credential_provider_write_password_finish(provider, res, |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
420 | &error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
421 | g_assert_no_error(error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
422 | g_assert_true(ret); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
423 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
424 | g_clear_object(&account); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
425 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
426 | g_main_loop_quit(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
427 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
428 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
429 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
430 | test_purple_credential_provider_test_write_idle(gpointer data) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
431 | PurpleCredentialProvider *p = PURPLE_CREDENTIAL_PROVIDER(data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
432 | PurpleAccount *account = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
433 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
434 | account = purple_account_new("test", "test"); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
435 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
436 | purple_credential_provider_write_password_async(p, account, NULL, NULL, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
437 | test_purple_credential_provider_test_write_cb, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
438 | account); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
439 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
440 | return G_SOURCE_REMOVE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
441 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
442 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
443 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
444 | test_purple_credential_provider_test_write(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
445 | PurpleCredentialProvider *p = test_purple_credential_provider_new(); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
446 | TestPurpleCredentialProvider *tp = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
447 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
448 | g_idle_add(test_purple_credential_provider_test_write_idle, p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
449 | g_timeout_add_seconds(10, test_purple_credential_provider_timeout_cb, loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
450 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
451 | g_main_loop_run(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
452 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
453 | g_assert_false(tp->read_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
454 | g_assert_false(tp->read_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
455 | g_assert_true(tp->write_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
456 | g_assert_true(tp->write_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
457 | g_assert_false(tp->clear_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
458 | g_assert_false(tp->clear_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
459 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
460 | g_clear_object(&p); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
461 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
462 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
463 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
464 | test_purple_credential_provider_test_clear_cb(GObject *obj, GAsyncResult *res, |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
465 | gpointer data) |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
466 | { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
467 | PurpleCredentialProvider *provider = PURPLE_CREDENTIAL_PROVIDER(obj); |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
468 | PurpleAccount *account = data; |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
469 | GError *error = NULL; |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
470 | gboolean ret = FALSE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
471 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
472 | ret = purple_credential_provider_clear_password_finish(provider, res, |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
473 | &error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
474 | g_assert_no_error(error); |
|
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
475 | g_assert_true(ret); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
476 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
477 | g_clear_object(&account); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
478 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
479 | g_main_loop_quit(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
480 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
481 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
482 | static gboolean |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
483 | test_purple_credential_provider_test_clear_idle(gpointer data) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
484 | PurpleCredentialProvider *p = PURPLE_CREDENTIAL_PROVIDER(data); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
485 | PurpleAccount *account = NULL; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
486 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
487 | account = purple_account_new("test", "test"); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
488 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
489 | purple_credential_provider_clear_password_async(p, account, NULL, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
490 | test_purple_credential_provider_test_clear_cb, |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
491 | account); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
492 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
493 | return G_SOURCE_REMOVE; |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
494 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
495 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
496 | static void |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
497 | test_purple_credential_provider_test_clear(void) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
498 | PurpleCredentialProvider *p = test_purple_credential_provider_new(); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
499 | TestPurpleCredentialProvider *tp = TEST_PURPLE_CREDENTIAL_PROVIDER(p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
500 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
501 | g_idle_add(test_purple_credential_provider_test_clear_idle, p); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
502 | g_timeout_add_seconds(10, test_purple_credential_provider_timeout_cb, loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
503 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
504 | g_main_loop_run(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
505 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
506 | g_assert_false(tp->read_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
507 | g_assert_false(tp->read_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
508 | g_assert_false(tp->write_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
509 | g_assert_false(tp->write_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
510 | g_assert_true(tp->clear_password_async); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
511 | g_assert_true(tp->clear_password_finish); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
512 | |
|
42241
43fdbe891f5a
Fix a number of issues in credential provider unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
42184
diff
changeset
|
513 | g_clear_object(&p); |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
514 | } |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
515 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
516 | /****************************************************************************** |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
517 | * Main |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
518 | *****************************************************************************/ |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
519 | gint |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
520 | main(gint argc, gchar *argv[]) { |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
521 | gint ret = 0; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
522 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
523 | g_test_init(&argc, &argv, NULL); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
524 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
525 | test_ui_purple_init(); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
526 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
527 | loop = g_main_loop_new(NULL, FALSE); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
528 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
529 | g_test_add_func("/credential-provider/is-valid/no-id", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
530 | test_purple_credential_provider_is_valid_no_id); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
531 | g_test_add_func("/credential-provider/is-valid/no-name", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
532 | test_purple_credential_provider_is_valid_no_name); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
533 | g_test_add_func("/credential-provider/is-valid/no-reader", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
534 | test_purple_credential_provider_is_valid_no_reader); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
535 | g_test_add_func("/credential-provider/is-valid/no-writer", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
536 | test_purple_credential_provider_is_valid_no_writer); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
537 | g_test_add_func("/credential-provider/is-valid/valid", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
538 | test_purple_credential_provider_is_valid_valid); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
539 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
540 | g_test_add_func("/credential-provider/functional/read", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
541 | test_purple_credential_provider_test_read); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
542 | g_test_add_func("/credential-provider/functional/write", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
543 | test_purple_credential_provider_test_write); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
544 | g_test_add_func("/credential-provider/functional/clear", |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
545 | test_purple_credential_provider_test_clear); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
546 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
547 | ret = g_test_run(); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
548 | |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
549 | g_main_loop_unref(loop); |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
550 | |
|
42184
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
551 | test_ui_purple_uninit(); |
|
4e1bf25f5575
Fix several leaks in tests
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42089
diff
changeset
|
552 | |
|
40548
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
553 | return ret; |
|
42556c49e1e2
Add PurpleCredentialProvider as the first piece to replace the existing keyring api.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
554 | } |