test_responder_cache_req.c revision 3a5ea81007bd38ce511c37f65cc45d4b6b95ec44
/*
Authors:
Pavel Březina <pbrezina@redhat.com>
Copyright (C) 2014 Red Hat
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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "tests/cmocka/common_mock_resp.h"
#include "responder/common/responder_cache_req.h"
#define TESTS_PATH "tests_responder_cache_req"
#define TEST_CONF_DB "test_responder_cache_req_conf.ldb"
#define TEST_DOM_NAME "responder_cache_req_test"
#define TEST_ID_PROVIDER "ldap"
#define TEST_USER_NAME "test-user"
#define TEST_USER_ID 1000
#define new_single_domain_test(test) \
#define new_multi_domain_test(test) \
struct cache_req_test_ctx {
struct sss_test_ctx *tctx;
struct sss_nc_ctx *ncache;
struct ldb_result *result;
struct sss_domain_info *domain;
bool dp_called;
bool create_user;
};
const char *domains[] = {"responder_cache_req_test_a",
"responder_cache_req_test_b",
"responder_cache_req_test_c",
"responder_cache_req_test_d",
NULL};
struct cli_protocol_version *register_cli_protocol_version(void)
{
static struct cli_protocol_version version[] = {
};
return version;
}
struct tevent_req *
struct sss_domain_info *dom,
bool fast_reply,
enum sss_dp_acct_type type,
const char *opt_name,
const char *extra)
{
if (ctx->create_user) {
}
}
{
}
{
}
static int test_single_domain_setup(void **state)
{
return 0;
}
static int test_single_domain_teardown(void **state)
{
return 0;
}
static int test_multi_domain_setup(void **state)
{
return 0;
}
static int test_multi_domain_teardown(void **state)
{
return 0;
}
void test_user_by_name_multiple_domains_found(void **state)
{
const char *name = TEST_USER_NAME;
"responder_cache_req_test_d", true);
SYSDB_NAME, NULL);
}
void test_user_by_name_multiple_domains_notfound(void **state)
{
const char *name = TEST_USER_NAME;
}
void test_user_by_name_cache_valid(void **state)
{
const char *name = TEST_USER_NAME;
SYSDB_NAME, NULL);
}
void test_user_by_name_cache_expired(void **state)
{
const char *name = TEST_USER_NAME;
/* DP should be contacted */
SYSDB_NAME, NULL);
}
void test_user_by_name_cache_midpoint(void **state)
{
const char *name = TEST_USER_NAME;
/* DP should be contacted without callback */
SYSDB_NAME, NULL);
}
void test_user_by_name_ncache(void **state)
{
const char *name = TEST_USER_NAME;
}
void test_user_by_name_missing_found(void **state)
{
const char *name = TEST_USER_NAME;
test_ctx->create_user = true;
SYSDB_NAME, NULL);
}
void test_user_by_name_missing_notfound(void **state)
{
const char *name = TEST_USER_NAME;
}
void test_user_by_id_multiple_domains_found(void **state)
{
const char *name = TEST_USER_NAME;
"responder_cache_req_test_d", true);
SYSDB_NAME, NULL);
SYSDB_UIDNUM, 0);
}
void test_user_by_id_multiple_domains_notfound(void **state)
{
}
void test_user_by_id_cache_valid(void **state)
{
const char *name = TEST_USER_NAME;
SYSDB_NAME, NULL);
SYSDB_UIDNUM, 0);
}
void test_user_by_id_cache_expired(void **state)
{
const char *name = TEST_USER_NAME;
/* DP should be contacted */
SYSDB_NAME, NULL);
SYSDB_UIDNUM, 0);
}
void test_user_by_id_cache_midpoint(void **state)
{
const char *name = TEST_USER_NAME;
/* DP should be contacted without callback */
SYSDB_NAME, NULL);
SYSDB_UIDNUM, 0);
}
void test_user_by_id_ncache(void **state)
{
}
void test_user_by_id_missing_found(void **state)
{
const char *name = TEST_USER_NAME;
test_ctx->create_user = true;
SYSDB_NAME, NULL);
SYSDB_UIDNUM, 0);
}
void test_user_by_id_missing_notfound(void **state)
{
}
{
int opt;
struct poptOption long_options[] = {
};
const struct CMUnitTest tests[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* Even though normally the tests should clean up after themselves
* they might not after a failed run. Remove the old db to be sure */
}