test_negcache.c revision d9e88bddc99bae0542b2179c9b94c968855b0fd0
/*
Authors:
Petr Čech <pcech@redhat.com>
Copyright (C) 2016 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 <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <popt.h>
#include "responder/common/negcache.h"
#include "responder/common/negcache_files.h"
#include "responder/common/responder.h"
#define TIMEOUT 10000
#define TEST_CONF_DB "test_sysdb_sudorules.ldb"
#define TEST_DOM_NAME "test_domain.test"
#define TEST_LOCAL_USER_NAME_1 "foobar"
#define TEST_LOCAL_USER_NAME_2 "sssd"
#define TEST_LOCAL_USER_UID_1 10001
#define TEST_LOCAL_USER_UID_2 123
#define TEST_LOCAL_GROUP_NAME_1 "foogroup"
#define TEST_LOCAL_GROUP_NAME_2 "sssd"
#define TEST_LOCAL_GID_1 10001
#define TEST_LOCAL_GID_2 123
struct test_user {
const char *name;
{ "test_user2", 1002, 50002 } };
{
for (int i = 0; i < 2; i++) {
}
}
struct test_group {
const char *name;
{ "test_group2", 50002 } };
struct ncache_test_ctx {
struct sss_test_ctx *tctx;
struct sss_nc_ctx *ncache;
};
{
for (int i = 0; i < 2; i++) {
}
}
/* register_cli_protocol_version is required in test since it links with
* responder_common.c module
*/
struct cli_protocol_version *register_cli_protocol_version(void)
{
static struct cli_protocol_version responder_test_cli_protocol_version[] = {
};
}
static int test_ncache_setup(void **state)
{
struct ncache_test_ctx *test_ctx;
return 0;
}
static int test_ncache_teardown(void **state)
{
struct ncache_test_ctx *test_ctx;
return 0;
}
/* user utils */
{
int ret;
}
{
int ret;
}
/* user tests */
void test_ncache_nocache_user(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_local_user(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_domain_user(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_both_user(void **state)
{
struct ncache_test_ctx *test_ctx;
}
/* uid utils */
{
int ret;
}
{
int ret;
}
/* uid tests */
void test_ncache_nocache_uid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_local_uid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_domain_uid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_both_uid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
/* group utils */
{
int ret;
}
{
int ret;
}
/* group tests */
void test_ncache_nocache_group(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_local_group(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_domain_group(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_both_group(void **state)
{
struct ncache_test_ctx *test_ctx;
}
/* gid utils */
{
int ret;
}
{
int ret;
}
/* uid tests */
void test_ncache_nocache_gid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_local_gid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_domain_gid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
void test_ncache_both_gid(void **state)
{
struct ncache_test_ctx *test_ctx;
}
{
int rv;
int opt;
struct poptOption long_options[] = {
};
const struct CMUnitTest tests[] = {
/* user */
/* uid */
/* group */
/* gid */
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch (opt) {
default:
return 1;
}
}
return rv;
}