summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-01-13 19:56:12 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 14:47:33 +0100
commita294438ef32b2a453f8cc8933056f8969a7ca510 (patch)
treecb5175afe7e1762de685ffd558a31b1d6004af13 /src
parentf91e4aacb78d33791efcd744000597d5254dac4b (diff)
downloadsssd-a294438ef32b2a453f8cc8933056f8969a7ca510.tar.gz
sssd-a294438ef32b2a453f8cc8933056f8969a7ca510.tar.bz2
sssd-a294438ef32b2a453f8cc8933056f8969a7ca510.zip
tests: add a unit test for sysdb_netgroup_base_dn
Diffstat (limited to 'src')
-rw-r--r--src/tests/sysdb-tests.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index f68ef249..958018fd 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3706,6 +3706,27 @@ START_TEST (test_sysdb_get_netgroup_attr)
}
END_TEST
+START_TEST (test_netgroup_base_dn)
+{
+ errno_t ret;
+ struct sysdb_test_ctx *test_ctx;
+ struct ldb_dn *base_dn;
+ const char *strdn;
+
+ ret = setup_sysdb_tests(&test_ctx);
+ fail_if(ret != EOK, "Could not set up the test");
+
+ base_dn = sysdb_netgroup_base_dn(test_ctx->sysdb, test_ctx, test_ctx->domain);
+ fail_if(base_dn == NULL, "Could not get netgroup base DN");
+
+ strdn = ldb_dn_get_linearized(base_dn);
+ fail_if(strdn == NULL, "Could not get string netgroup base DN");
+
+ fail_if(strstr(strdn, SYSDB_NETGROUP_CONTAINER) != strdn,
+ "Malformed netgroup baseDN");
+}
+END_TEST
+
START_TEST(test_odd_characters)
{
errno_t ret;
@@ -4872,6 +4893,8 @@ Suite *create_sysdb_suite(void)
/* Remove the other half by DN */
tcase_add_loop_test(tc_sysdb, test_sysdb_remove_netgroup_entry, 27005, 27010);
+ tcase_add_test(tc_sysdb, test_netgroup_base_dn);
+
/* ===== SERVICE TESTS ===== */
/* Create a new service */