summaryrefslogtreecommitdiff
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/sysdb-tests.c')
-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 */