summaryrefslogtreecommitdiffstats
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-11-28 11:28:39 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-12-19 10:24:16 +0100
commit48eb2ca157f7cdc625d0eacdcdc085a3fe1a0fc8 (patch)
treeee1ee2cad7766af045c7bcc2e97670d0c832c18a /src/tests/sysdb-tests.c
parentc246e2315cb8df1e347bec3b728f91b0c1264f93 (diff)
downloadsssd-48eb2ca157f7cdc625d0eacdcdc085a3fe1a0fc8.tar.gz
sssd-48eb2ca157f7cdc625d0eacdcdc085a3fe1a0fc8.tar.xz
sssd-48eb2ca157f7cdc625d0eacdcdc085a3fe1a0fc8.zip
Add sysdb_attrs_add_lc_name_alias
Diffstat (limited to 'src/tests/sysdb-tests.c')
-rw-r--r--src/tests/sysdb-tests.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index cc2d66149..ee0030c14 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -4332,6 +4332,33 @@ START_TEST(test_sysdb_svc_remove_alias)
}
END_TEST
+#define LC_NAME_ALIAS_TEST_VAL "TeSt VaLuE"
+#define LC_NAME_ALIAS_CHECK_VAL "test value"
+START_TEST(test_sysdb_attrs_add_lc_name_alias)
+{
+ int ret;
+ struct sysdb_attrs *attrs;
+ const char *str;
+
+ ret = sysdb_attrs_add_lc_name_alias(NULL, NULL);
+ fail_unless(ret == EINVAL, "EINVAL not returned for NULL input");
+
+ attrs = sysdb_new_attrs(NULL);
+ fail_unless(attrs != NULL, "sysdb_new_attrs failed");
+
+ ret = sysdb_attrs_add_lc_name_alias(attrs, LC_NAME_ALIAS_TEST_VAL);
+ fail_unless(ret == EOK, "sysdb_attrs_add_lc_name_alias failed");
+
+ ret = sysdb_attrs_get_string(attrs, SYSDB_NAME_ALIAS, &str);
+ fail_unless(ret == EOK, "sysdb_attrs_get_string failed");
+ fail_unless(strcmp(str, LC_NAME_ALIAS_CHECK_VAL) == 0,
+ "Unexpected value, expected [%s], got [%s]",
+ LC_NAME_ALIAS_CHECK_VAL, str);
+
+ talloc_free(attrs);
+}
+END_TEST
+
START_TEST(test_sysdb_has_enumerated)
{
errno_t ret;
@@ -5090,6 +5117,8 @@ Suite *create_sysdb_suite(void)
tcase_add_test(tc_sysdb, test_sysdb_store_services);
tcase_add_test(tc_sysdb, test_sysdb_svc_remove_alias);
+ tcase_add_test(tc_sysdb, test_sysdb_attrs_add_lc_name_alias);
+
/* Add all test cases to the test suite */
suite_add_tcase(s, tc_sysdb);