summaryrefslogtreecommitdiffstats
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-20 19:55:15 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:16 -0400
commit88e7576d8bf00bfd0eaed8731b7eee1d6b6e05a1 (patch)
tree425d71e756b90a12358662e1f36c0b7d311b3545 /src/tests/sysdb-tests.c
parentfa362558a3f89644dab60debfbc423fe31a39f00 (diff)
downloadsssd_unused-88e7576d8bf00bfd0eaed8731b7eee1d6b6e05a1.tar.gz
sssd_unused-88e7576d8bf00bfd0eaed8731b7eee1d6b6e05a1.tar.xz
sssd_unused-88e7576d8bf00bfd0eaed8731b7eee1d6b6e05a1.zip
sysdb: convert sysdb_enumgrent
Diffstat (limited to 'src/tests/sysdb-tests.c')
-rw-r--r--src/tests/sysdb-tests.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index bfd640bc..2a84da94 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -305,26 +305,6 @@ static int test_remove_group_by_gid(struct test_data *data)
return ret;
}
-static void test_enumgrent(void *pvt, int error, struct ldb_result *res)
-{
- struct test_data *data = talloc_get_type(pvt, struct test_data);
- const int expected = 20; /* 10 groups + 10 users (we're MPG) */
-
- data->finished = true;
-
- if (error != EOK) {
- data->error = error;
- return;
- }
-
- if (res->count != expected) {
- data->error = EINVAL;
- return;
- }
-
- data->error = EOK;
-}
-
static int test_set_user_attr(struct test_data *data)
{
int ret;
@@ -890,7 +870,7 @@ END_TEST
START_TEST (test_sysdb_enumgrent)
{
struct sysdb_test_ctx *test_ctx;
- struct test_data *data;
+ struct ldb_result *res;
int ret;
/* Setup */
@@ -900,22 +880,17 @@ START_TEST (test_sysdb_enumgrent)
return;
}
- data = talloc_zero(test_ctx, struct test_data);
- data->ctx = test_ctx;
-
ret = sysdb_enumgrent(test_ctx,
- test_ctx->sysdb,
- data->ctx->domain,
- test_enumgrent,
- data);
- if (ret == EOK) {
- ret = test_loop(data);
- }
-
+ test_ctx->sysdb,
+ test_ctx->domain,
+ &res);
fail_unless(ret == EOK,
"sysdb_enumgrent failed (%d: %s)",
ret, strerror(ret));
+ /* 10 groups + 10 users (we're MPG) */
+ fail_if(res->count != 20, "Expected 20 users, got %d", res->count);
+
talloc_free(test_ctx);
}
END_TEST