summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka/test_nested_groups.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-05-29 15:46:57 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-06-14 21:47:20 +0200
commit28600ab8d160faa24aae379628dd8a58f50d13c6 (patch)
tree3ec8124bb25a6c7ad8bbc2e9fdcf4d494812d9f3 /src/tests/cmocka/test_nested_groups.c
parentd43c9d18fb263b1ea4071b20e93ce4994583f62f (diff)
downloadsssd-28600ab8d160faa24aae379628dd8a58f50d13c6.tar.gz
sssd-28600ab8d160faa24aae379628dd8a58f50d13c6.tar.xz
sssd-28600ab8d160faa24aae379628dd8a58f50d13c6.zip
TESTS: Add a common function to set up sdap_id_ctx
Reduces code duplication between tests. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/tests/cmocka/test_nested_groups.c')
-rw-r--r--src/tests/cmocka/test_nested_groups.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/tests/cmocka/test_nested_groups.c b/src/tests/cmocka/test_nested_groups.c
index 75fb3a19f..390b39950 100644
--- a/src/tests/cmocka/test_nested_groups.c
+++ b/src/tests/cmocka/test_nested_groups.c
@@ -54,6 +54,7 @@
struct nested_groups_test_ctx {
struct sss_test_ctx *tctx;
+ struct be_ctx *be_ctx;
struct sdap_options *sdap_opts;
struct sdap_handle *sdap_handle;
struct sdap_domain *sdap_domain;
@@ -596,14 +597,13 @@ static int nested_groups_test_setup(void **state)
test_ctx->sdap_handle = mock_sdap_handle(test_ctx);
assert_non_null(test_ctx->sdap_handle);
- test_ctx->sdap_id_ctx = talloc_zero(test_ctx,
- struct sdap_id_ctx);
- assert_non_null(test_ctx->sdap_id_ctx);
-
- test_ctx->sdap_id_ctx->be = mock_be_ctx(test_ctx, test_ctx->tctx);
- assert_non_null(test_ctx->sdap_id_ctx->be);
+ test_ctx->be_ctx = mock_be_ctx(test_ctx, test_ctx->tctx);
+ assert_non_null(test_ctx->be_ctx);
- test_ctx->sdap_id_ctx->opts = test_ctx->sdap_opts;
+ test_ctx->sdap_id_ctx = mock_sdap_id_ctx(test_ctx,
+ test_ctx->be_ctx,
+ test_ctx->sdap_opts);
+ assert_non_null(test_ctx->sdap_id_ctx);
ret = sdap_idmap_init(test_ctx, test_ctx->sdap_id_ctx, &test_ctx->idmap_ctx);
assert_int_equal(ret, EOK);