test_ldap_id_cleanup.c revision e2e334b2f51118cb14c7391c4e4e44ff247ef638
/*
Authors:
Pavel Reichl <preichl@redhat.com>
Copyright (C) 2015 Red Hat
SSSD tests - id cleanup
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
#include <setjmp.h>
#include <unistd.h>
#include <cmocka.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "providers/ldap/ldap_auth.h"
#include "tests/cmocka/test_expire_common.h"
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/ldap_opts.h"
#include "providers/ipa/ipa_opts.h"
#define TESTS_PATH "test_ldap_id_cleanup"
#define TEST_CONF_FILE "tests_conf.ldb"
struct sysdb_test_ctx {
struct confdb_ctx *confdb;
struct tevent_context *ev;
struct sss_domain_info *domain;
struct sdap_options *opts;
};
{
struct sysdb_test_ctx *test_ctx;
char *conf_db;
int ret;
const char *val[2];
/* Create tests directory if it doesn't exist */
/* (relative to current dir) */
/* Create an event context
* It will not be used except in confdb_init and sysdb_init
*/
/* Connect to the conf db */
val[0] = "LOCAL";
val[0] = "local";
val[0] = "TRUE";
return EOK;
}
static int test_sysdb_setup(void **state)
{
int ret;
struct sysdb_test_ctx *test_ctx;
/* set options */
return 0;
}
static int test_sysdb_teardown(void **state)
{
struct sysdb_test_ctx);
return 0;
}
struct sss_domain_info *domain,
const char *name)
{
if (sys_attrs) {
SYSDB_CACHE_EXPIRE, 1);
} else {
"Could not add expiration time to attributes\n");
}
} else {
}
return ret;
}
static void test_id_cleanup_exp_group(void **state)
{
struct ldb_message *msg;
struct sdap_domain sdom;
const char *special_grp = "special_gr*o/u\\p(2016)";
const char *empty_special_grp = "empty_gr*o/u\\p(2016)";
const char *empty_grp = "empty_grp";
const char *grp = "grp";
struct sysdb_test_ctx);
10001, 10002, "Test user",
0,0);
10002, 10004, "Test user",
0,0);
/* not expired */
/* let records to expire */
}
{
int rv;
int no_cleanup = 0;
int opt;
struct poptOption long_options[] = {
_("Do not delete the test database after a test run"), NULL },
};
const struct CMUnitTest tests[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
if (rv == 0 && no_cleanup == 0) {
}
return rv;
}