summaryrefslogtreecommitdiffstats
path: root/src/tests/cmocka
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-05-15 13:17:50 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-06-14 21:47:23 +0200
commit933314e53fac878d1a9b126af216454172cb945a (patch)
tree8c86676ea35beb9ffab8ad9e7c6431f51eeacf78 /src/tests/cmocka
parent51b5e1475b3e0b7acac34ed382cfaca8411883a4 (diff)
downloadsssd-933314e53fac878d1a9b126af216454172cb945a.tar.gz
sssd-933314e53fac878d1a9b126af216454172cb945a.tar.xz
sssd-933314e53fac878d1a9b126af216454172cb945a.zip
AD: Split off ad_create_default_options
Related: https://fedorahosted.org/sssd/ticket/2638 Make the function reusable and add a simple unit test. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/tests/cmocka')
-rw-r--r--src/tests/cmocka/test_ad_common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tests/cmocka/test_ad_common.c b/src/tests/cmocka/test_ad_common.c
index 0013d7833..de00e53f9 100644
--- a/src/tests/cmocka/test_ad_common.c
+++ b/src/tests/cmocka/test_ad_common.c
@@ -59,6 +59,22 @@ struct ad_common_test_ctx {
struct sss_domain_info *subdom;
};
+static void test_ad_create_default_options(void **state)
+{
+ struct ad_options *ad_options;
+ const char *s;
+
+ ad_options = ad_create_default_options(global_talloc_context);
+
+ assert_non_null(ad_options->basic);
+
+ /* Not too much to test here except some defaults */
+ s = dp_opt_get_string(ad_options->basic, AD_DOMAIN);
+ assert_null(s);
+
+ assert_non_null(ad_options->id);
+}
+
static int test_ad_common_setup(void **state)
{
struct ad_common_test_ctx *test_ctx;
@@ -318,6 +334,7 @@ int main(int argc, const char *argv[])
};
const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_ad_create_default_options),
cmocka_unit_test_setup_teardown(test_ad_create_2way_trust_options,
test_ad_common_setup,
test_ad_common_teardown),