/*
SSSD
sysdb_views - Tests for view and override related sysdb calls
Authors:
Sumit Bose <sbose@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 <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
#include "db/sysdb_private.h" /* for sysdb->ldb member */
struct sysdb_test_ctx {
};
{
char *conf_db;
int ret;
/* 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;
}
{
int ret;
return 0;
}
{
struct sysdb_test_ctx);
return 0;
}
{
int ret;
char *name;
struct sysdb_test_ctx);
0,0);
/* No override exists */
/* Missing anchor attribute */
/* With anchor */
}
{
int ret;
char *tmp_str;
struct sysdb_test_ctx);
"ORIGNAME");
"ORIGGECOS");
NULL),
"OVERRIDENAME");
NULL),
"OVERRIDEGECOS");
}
{
int ret;
char *tmp_str;
struct sysdb_test_ctx);
}
{
int ret;
char *tmp_str;
struct sysdb_test_ctx);
"cn=somedn,dc=example,dc=com");
}
{
int ret;
char *dom;
char *uuid;
struct sysdb_test_ctx);
}
{
int ret;
char *name;
struct sysdb_test_ctx);
0,0);
}
{
int ret;
char *name;
NULL};
struct sysdb_test_ctx);
10,0);
user_attrs, &msg);
user_attrs, &msg);
1);
}
const char *name)
{
int ret;
const char *anchor;
const char *override_gecos;
}
const char *usernames[])
{
int i;
int ret;
}
}
const char *usernames[])
{
int i;
int ret;
fail();
}
}
}
{
int ret;
return 0;
}
static int cmp_func(const void *a, const void *b)
{
const char *str1;
const char *str2;
}
/* Make the order of ldb results deterministic */
{
/* Nothing to do */
return;
}
return;
}
struct sss_domain_info *dom,
const char *shortname,
bool has_views)
{
const char *str;
char *fqname;
if (has_views) {
char *override;
} else {
}
}
{
struct sysdb_test_ctx);
return test_sysdb_teardown(state);
}
{
}
{
int ret;
struct sysdb_test_ctx);
}
{
int ret;
struct sysdb_test_ctx);
}
{
int ret;
struct sysdb_test_ctx);
char *addtl_filter;
/* Test searching based on time as well */
SYSDB_LAST_UPDATE, 1233);
SYSDB_LAST_UPDATE, 1234);
}
{
int ret;
struct sysdb_test_ctx);
char *addtl_filter;
SYSDB_LAST_UPDATE, 1235);
}
const char *name,
unsigned override_gid)
{
int ret;
const char *anchor;
}
const char *groupnames[])
{
int i;
int ret;
char *gr_name;
for (i = 0; groupnames[i] != NULL; i++) {
TEST_GID_OVERRIDE_BASE + i);
}
}
const char *groupnames[])
{
int i;
int ret;
for (i = 0; groupnames[i] != NULL; i++) {
fail();
}
}
}
{
int ret;
return 0;
}
{
struct sysdb_test_ctx);
return test_sysdb_teardown(state);
}
struct sss_domain_info *dom,
const char *shortname,
unsigned expected_override_gid)
{
const char *str;
unsigned gid;
char *fqname;
if (expected_override_gid) {
}
}
{
views ? TEST_GID_OVERRIDE_BASE : 0);
}
{
int ret;
struct sysdb_test_ctx);
}
{
int ret;
struct sysdb_test_ctx);
}
{
int ret;
struct sysdb_test_ctx);
char *addtl_filter;
SYSDB_LAST_UPDATE, 1233);
SYSDB_LAST_UPDATE, 1234);
}
{
int ret;
struct sysdb_test_ctx);
char *addtl_filter;
"one", TEST_GID_OVERRIDE_BASE);
TEST_GID_OVERRIDE_BASE + 1);
SYSDB_LAST_UPDATE, 1235);
TEST_GID_OVERRIDE_BASE + 1);
}
{
int rv;
int no_cleanup = 0;
int opt;
_("Do not delete the test database after a test run"), NULL },
};
};
/* Set debug level to invalid value so we can decide if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
if (rv == 0 && no_cleanup == 0) {
}
return rv;
}