test_responder_cache_req.c revision 4e5e846de22407f825fe3b4040d79606818a2419
/*
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 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_multiple_domains_found(void **state)
{
const char *name = "test-user";
"responder_cache_req_test_d", true);
SYSDB_NAME, NULL);
}
void test_user_multiple_domains_notfound(void **state)
{
const char *name = "test-user";
}
void test_user_cache_valid(void **state)
{
const char *name = "test-user";
SYSDB_NAME, NULL);
}
void test_user_cache_expired(void **state)
{
const char *name = "test-user";
/* DP should be contacted */
SYSDB_NAME, NULL);
}
void test_user_cache_midpoint(void **state)
{
const char *name = "test-user";
/* DP should be contacted without callback */
SYSDB_NAME, NULL);
}
void test_user_ncache(void **state)
{
const char *name = "test-user";
}
void test_user_missing_found(void **state)
{
const char *name = "test-user";
test_ctx->create_user = true;
SYSDB_NAME, NULL);
}
void test_user_missing_notfound(void **state)
{
const char *name = "test-user";
}
{
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 */
}