summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-05-26 19:13:16 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-05-28 16:41:17 +0200
commit5246ab9134aa2c8b977b3b1f7b0929cfbbaf951f (patch)
treeb0c322e7a173fb13373d8d001ac868a5f19c4a28
parentc61aa53b0d4631630e6757c62193a10b50c8c2e0 (diff)
downloadsssd-5246ab9134aa2c8b977b3b1f7b0929cfbbaf951f.tar.gz
sssd-5246ab9134aa2c8b977b3b1f7b0929cfbbaf951f.tar.xz
sssd-5246ab9134aa2c8b977b3b1f7b0929cfbbaf951f.zip
tests: Add test for get_known_services
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
-rw-r--r--src/tests/util-tests.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index 5d378e4f8..198edf597 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -957,6 +957,27 @@ START_TEST(test_is_host_in_domain)
}
END_TEST
+START_TEST(test_known_service)
+{
+ const char * const * svcs;
+ bool found_nss;
+ int i;
+
+ /* Just make sure we can't find a bogus service and nss
+ * is always available
+ */
+ svcs = get_known_services();
+ for (i = 0; svcs[i]; i++) {
+ ck_assert_str_ne(svcs[i], "nosuchservice");
+ if (strcmp(svcs[i], "nss")) {
+ found_nss = true;
+ }
+ }
+
+ ck_assert(found_nss == true);
+}
+END_TEST
+
Suite *util_suite(void)
{
Suite *s = suite_create("util");
@@ -976,6 +997,7 @@ Suite *util_suite(void)
tcase_add_test (tc_util, test_check_ipv4_addr);
tcase_add_test (tc_util, test_check_ipv6_addr);
tcase_add_test (tc_util, test_is_host_in_domain);
+ tcase_add_test (tc_util, test_known_service);
tcase_set_timeout(tc_util, 60);
TCase *tc_utf8 = tcase_create("utf8");