diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-02-28 13:13:33 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-04-12 09:22:13 -0400 |
commit | a6ecb562529430be5a4cd6e8cdd541a383c9a2e1 (patch) | |
tree | 2defd9f6ed5fd10b84b85484de06583e1242c13e /src/tests | |
parent | c4a8b4169eea9661156d78dfe73a723fc5b61697 (diff) | |
download | sssd-a6ecb562529430be5a4cd6e8cdd541a383c9a2e1.tar.gz sssd-a6ecb562529430be5a4cd6e8cdd541a383c9a2e1.tar.bz2 sssd-a6ecb562529430be5a4cd6e8cdd541a383c9a2e1.zip |
sysdb: convert sysdb_store/add(_basic)_user
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/sysdb-tests.c | 52 |
1 files changed, 9 insertions, 43 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index 519d1c4b..e75a415f 100644 --- a/src/tests/sysdb-tests.c +++ b/src/tests/sysdb-tests.c @@ -223,8 +223,6 @@ fail: data->finished = true; } -static void test_add_user_done(struct tevent_req *subreq); - static void test_add_user(struct tevent_req *subreq) { struct test_data *data = tevent_req_callback_data(subreq, @@ -242,34 +240,17 @@ static void test_add_user(struct tevent_req *subreq) homedir = talloc_asprintf(data, "/home/testuser%d", data->uid); gecos = talloc_asprintf(data, "Test User %d", data->uid); - subreq = sysdb_add_user_send(data, data->ev, data->handle, - data->ctx->domain, data->username, - data->uid, 0, - gecos, homedir, "/bin/bash", - NULL, 0); - if (!subreq) { - return test_return(data, ENOMEM); - } - tevent_req_set_callback(subreq, test_add_user_done, data); -} - -static void test_add_user_done(struct tevent_req *subreq) -{ - struct test_data *data = tevent_req_callback_data(subreq, struct test_data); - int ret; - - ret = sysdb_add_user_recv(subreq); - talloc_zfree(subreq); + ret = sysdb_add_user(data, data->handle->ctx, + data->ctx->domain, data->username, + data->uid, 0, gecos, homedir, "/bin/bash", + NULL, 0); return test_return(data, ret); } -static void test_store_user_done(struct tevent_req *subreq); - static void test_store_user(struct tevent_req *req) { struct test_data *data = tevent_req_callback_data(req, struct test_data); - struct tevent_req *subreq; char *homedir; char *gecos; int ret; @@ -282,26 +263,11 @@ static void test_store_user(struct tevent_req *req) homedir = talloc_asprintf(data, "/home/testuser%d", data->uid); gecos = talloc_asprintf(data, "Test User %d", data->uid); - subreq = sysdb_store_user_send(data, data->ev, data->handle, - data->ctx->domain, data->username, "x", - data->uid, 0, - gecos, homedir, - data->shell ? data->shell : "/bin/bash", - NULL, -1); - if (!subreq) { - test_return(data, ENOMEM); - return; - } - tevent_req_set_callback(subreq, test_store_user_done, data); -} - -static void test_store_user_done(struct tevent_req *subreq) -{ - struct test_data *data = tevent_req_callback_data(subreq, struct test_data); - int ret; - - ret = sysdb_store_user_recv(subreq); - talloc_zfree(subreq); + ret = sysdb_store_user(data, data->handle->ctx, + data->ctx->domain, data->username, "x", + data->uid, 0, gecos, homedir, + data->shell ? data->shell : "/bin/bash", + NULL, -1); return test_return(data, ret); } |