summaryrefslogtreecommitdiff
path: root/server/tests
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-11-07 21:21:36 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-10 09:33:57 -0500
commit0f6f40eee34677b0169fe9fdbbf65c3a838165bb (patch)
treea51c9894ac2fc7840289454f91b4929b554af696 /server/tests
parente31821dd6f4a4ca9d07b367c26bfb21d6755bef0 (diff)
downloadsssd-0f6f40eee34677b0169fe9fdbbf65c3a838165bb.tar.gz
sssd-0f6f40eee34677b0169fe9fdbbf65c3a838165bb.tar.bz2
sssd-0f6f40eee34677b0169fe9fdbbf65c3a838165bb.zip
Refactor delete functions and add a few
Refactor user/group delete functions so that they can be used without a transaction (they autostart an operation). Add user and group search function where a subfilter can be specified.
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/sysdb-tests.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/server/tests/sysdb-tests.c b/server/tests/sysdb-tests.c
index 32ed7bb2..fffcb72a 100644
--- a/server/tests/sysdb-tests.c
+++ b/server/tests/sysdb-tests.c
@@ -340,10 +340,10 @@ static void test_remove_user_by_uid(struct tevent_req *req)
return test_return(data, ret);
}
- subreq = sysdb_delete_user_by_uid_send(data,
- data->ev, data->handle,
- data->ctx->domain, data->uid,
- true);
+ subreq = sysdb_delete_user_send(data, data->ev,
+ NULL, data->handle,
+ data->ctx->domain,
+ NULL, data->uid);
if (!subreq) return test_return(data, ENOMEM);
tevent_req_set_callback(subreq, test_remove_user_by_uid_done, data);
@@ -355,7 +355,8 @@ static void test_remove_user_by_uid_done(struct tevent_req *subreq)
struct test_data);
int ret;
- ret = sysdb_delete_user_by_uid_recv(subreq);
+ ret = sysdb_delete_user_recv(subreq);
+ if (ret == ENOENT) ret = EOK;
talloc_zfree(subreq);
return test_return(data, ret);
@@ -374,10 +375,10 @@ static void test_remove_nonexistent_group(struct tevent_req *req)
return test_return(data, ret);
}
- subreq = sysdb_delete_group_by_gid_send(data,
- data->ev, data->handle,
- data->ctx->domain, data->uid,
- false);
+ subreq = sysdb_delete_group_send(data, data->ev,
+ NULL, data->handle,
+ data->ctx->domain,
+ NULL, data->uid);
if (!subreq) return test_return(data, ENOMEM);
tevent_req_set_callback(subreq, test_remove_nonexistent_group_done, data);
@@ -389,7 +390,7 @@ static void test_remove_nonexistent_group_done(struct tevent_req *subreq)
struct test_data);
int ret;
- ret = sysdb_delete_group_by_gid_recv(subreq);
+ ret = sysdb_delete_group_recv(subreq);
talloc_zfree(subreq);
return test_return(data, ret);
@@ -408,10 +409,10 @@ static void test_remove_nonexistent_user(struct tevent_req *req)
return test_return(data, ret);
}
- subreq = sysdb_delete_user_by_uid_send(data,
- data->ev, data->handle,
- data->ctx->domain, data->uid,
- false);
+ subreq = sysdb_delete_user_send(data, data->ev,
+ NULL, data->handle,
+ data->ctx->domain,
+ NULL, data->uid);
if (!subreq) return test_return(data, ENOMEM);
tevent_req_set_callback(subreq, test_remove_nonexistent_user_done, data);
@@ -423,7 +424,7 @@ static void test_remove_nonexistent_user_done(struct tevent_req *subreq)
struct test_data);
int ret;
- ret = sysdb_delete_user_by_uid_recv(subreq);
+ ret = sysdb_delete_user_recv(subreq);
talloc_zfree(subreq);
return test_return(data, ret);
@@ -543,9 +544,10 @@ static void test_remove_group_by_gid(struct tevent_req *req)
return test_return(data, ret);
}
- subreq = sysdb_delete_group_by_gid_send(data, data->ev, data->handle,
- data->ctx->domain, data->gid,
- true);
+ subreq = sysdb_delete_group_send(data, data->ev,
+ NULL, data->handle,
+ data->ctx->domain,
+ NULL, data->gid);
if (!subreq) return test_return(data, ENOMEM);
tevent_req_set_callback(subreq, test_remove_group_by_gid_done, data);
@@ -557,7 +559,8 @@ static void test_remove_group_by_gid_done(struct tevent_req *subreq)
struct test_data);
int ret;
- ret = sysdb_delete_group_by_gid_recv(subreq);
+ ret = sysdb_delete_group_recv(subreq);
+ if (ret == ENOENT) ret = EOK;
talloc_zfree(subreq);
return test_return(data, ret);