summaryrefslogtreecommitdiffstats
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-03-20 19:09:30 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-12 09:22:16 -0400
commitfa362558a3f89644dab60debfbc423fe31a39f00 (patch)
treef45675b4e0cff5ec97ab2454625eed1e53623d73 /src/tests/sysdb-tests.c
parent08d9d10747da6900971cdd8fced05ca66f5111e2 (diff)
downloadsssd-fa362558a3f89644dab60debfbc423fe31a39f00.tar.gz
sssd-fa362558a3f89644dab60debfbc423fe31a39f00.tar.xz
sssd-fa362558a3f89644dab60debfbc423fe31a39f00.zip
sysdb: convert sysdb_enumpwent
Diffstat (limited to 'src/tests/sysdb-tests.c')
-rw-r--r--src/tests/sysdb-tests.c37
1 files changed, 5 insertions, 32 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 62ad6d160..bfd640bcd 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -325,26 +325,6 @@ static void test_enumgrent(void *pvt, int error, struct ldb_result *res)
data->error = EOK;
}
-static void test_enumpwent(void *pvt, int error, struct ldb_result *res)
-{
- struct test_data *data = talloc_get_type(pvt, struct test_data);
- const int expected = 10;
-
- 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;
@@ -943,7 +923,7 @@ END_TEST
START_TEST (test_sysdb_enumpwent)
{
struct sysdb_test_ctx *test_ctx;
- struct test_data *data;
+ struct ldb_result *res;
int ret;
/* Setup */
@@ -953,23 +933,16 @@ START_TEST (test_sysdb_enumpwent)
return;
}
- data = talloc_zero(test_ctx, struct test_data);
- data->ctx = test_ctx;
-
ret = sysdb_enumpwent(test_ctx,
test_ctx->sysdb,
- data->ctx->domain,
- NULL,
- test_enumpwent,
- data);
- if (ret == EOK) {
- ret = test_loop(data);
- }
-
+ test_ctx->domain,
+ &res);
fail_unless(ret == EOK,
"sysdb_enumpwent failed (%d: %s)",
ret, strerror(ret));
+ fail_if(res->count != 10, "Expected 10 users, got %d", res->count);
+
talloc_free(test_ctx);
}
END_TEST