summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-12-08 14:35:35 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-12-20 07:41:59 -0500
commit84bb9ec1bba8e60d1d87febd48749edd18e16787 (patch)
tree342bd67a6f9df94674eb183fcb593f605ad733e1 /src/tests
parent6c4661b78edafbd5b44e0c6319243e6671260bd0 (diff)
downloadsssd-84bb9ec1bba8e60d1d87febd48749edd18e16787.tar.gz
sssd-84bb9ec1bba8e60d1d87febd48749edd18e16787.tar.bz2
sssd-84bb9ec1bba8e60d1d87febd48749edd18e16787.zip
Add sysdb_has_enumerated and sysdb_set_enumerated helper functions
Includes a unit test
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/sysdb-tests.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index c6d1678c..2beb2588 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -2860,6 +2860,43 @@ START_TEST(test_odd_characters)
}
END_TEST
+START_TEST(test_sysdb_has_enumerated)
+{
+ errno_t ret;
+ struct sysdb_test_ctx *test_ctx;
+ bool enumerated;
+
+ /* Setup */
+ ret = setup_sysdb_tests(&test_ctx);
+ fail_if(ret != EOK, "Could not set up the test");
+
+ ret = sysdb_has_enumerated(test_ctx->sysdb,
+ test_ctx->domain,
+ &enumerated);
+ fail_if(ret != EOK, "Error [%d][%s] checking enumeration",
+ ret, strerror(ret));
+
+ fail_if(enumerated, "Enumeration should default to false");
+
+ ret = sysdb_set_enumerated(test_ctx->sysdb,
+ test_ctx->domain,
+ true);
+ fail_if(ret != EOK, "Error [%d][%s] setting enumeration",
+ ret, strerror(ret));
+
+ /* Recheck enumeration status */
+ ret = sysdb_has_enumerated(test_ctx->sysdb,
+ test_ctx->domain,
+ &enumerated);
+ fail_if(ret != EOK, "Error [%d][%s] checking enumeration",
+ ret, strerror(ret));
+
+ fail_unless(enumerated, "Enumeration should have been set to true");
+
+ talloc_free(test_ctx);
+}
+END_TEST
+
Suite *create_sysdb_suite(void)
{
Suite *s = suite_create("sysdb");
@@ -2984,6 +3021,9 @@ Suite *create_sysdb_suite(void)
/* Test unusual characters */
tcase_add_test(tc_sysdb, test_odd_characters);
+ /* Test sysdb enumerated flag */
+ tcase_add_test(tc_sysdb, test_sysdb_has_enumerated);
+
/* ===== NETGROUP TESTS ===== */
/* Create a new netgroup */