1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of gsignond
6 * Copyright (C) 2012 Intel Corporation.
8 * Contact: Alexander Kanavin <alex.kanavin@gmail.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 #include "gsignond-oauth-plugin.h"
29 #include <gsignond/gsignond-session-data.h>
30 #include <gsignond/gsignond-plugin-interface.h>
31 #include <gsignond/gsignond-error.h>
32 #include <gsignond/gsignond-config.h>
33 #include <libsoup/soup.h>
35 void add_oauth1_tcase(Suite *s);
36 void add_oauth2_tcase(Suite *s);
38 static void check_plugin(GSignondPlugin* plugin)
43 fail_if(plugin == NULL);
45 g_object_get(plugin, "type", &type, "mechanisms", &mechanisms, NULL);
47 fail_unless(g_strcmp0(type, "oauth") == 0);
48 fail_unless(g_strcmp0(mechanisms[0], "oauth1") == 0);
49 fail_unless(g_strcmp0(mechanisms[1], "oauth2") == 0);
50 fail_unless(mechanisms[2] == NULL);
53 g_strfreev(mechanisms);
56 START_TEST (test_oauthplugin_create)
60 plugin = g_object_new(GSIGNOND_TYPE_OAUTH_PLUGIN, NULL);
62 g_object_unref(plugin);
67 Suite* oauthplugin_suite (void)
69 Suite *s = suite_create ("OAUTH plugin");
71 TCase *tc_oauth_plugin = tcase_create ("OAuth plugin tests");
72 tcase_add_test (tc_oauth_plugin, test_oauthplugin_create);
73 suite_add_tcase (s, tc_oauth_plugin);
85 #if !GLIB_CHECK_VERSION (2, 36, 0)
89 Suite *s = oauthplugin_suite();
90 SRunner *sr = srunner_create(s);
91 srunner_run_all(sr, CK_NORMAL);
92 number_failed = srunner_ntests_failed(sr);
94 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;