simple_access-tests.c revision d115f40c7a3999e3cbe705a2ff9cf0fd493f80fb
/*
SSSD
Simple access module -- Tests
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2010 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 <popt.h>
#include <check.h>
#include "providers/simple/simple_access.h"
#define TESTS_PATH "tests_simple_access"
#define TEST_CONF_FILE "tests_conf.ldb"
struct simple_test_ctx {
struct confdb_ctx *confdb;
struct tevent_context *ev;
bool done;
int error;
bool access_granted;
struct simple_ctx *ctx;
};
{
}
{
struct simple_test_ctx *tctx =
}
void setup_simple(void)
{
char *conf_db;
const char *val[2];
/* Create tests directory if it doesn't exist */
/* (relative to current dir) */
"Could not create %s directory", TESTS_PATH);
/* Connect to the conf db */
val[0] = "LOCAL";
val[0] = "local";
val[0] = "TRUE";
val[0] = "TRUE";
/* be_ctx */
}
void teardown_simple(void)
{
int ret;
}
void setup_simple_group(void)
{
setup_simple();
/* Add test users u1 and u2 that would be members of test groups
* g1 and g2 respectively */
}
void teardown_simple_group(void)
{
}
void setup_simple_init(void)
{
setup_simple();
}
void teardown_simple_init(void)
{
}
{
struct tevent_req *req;
"Access denied while both lists are empty.");
}
{
struct tevent_req *req;
"Access granted while user is in deny list.");
"Access denied while user is not in deny list.");
}
{
struct tevent_req *req;
"Access denied while user is in allow list.");
"Access granted while user is not in allow list.");
}
{
struct tevent_req *req;
"Access granted while user is in deny list.");
"Access granted while user is not in allow list.");
}
{
struct tevent_req *req;
"Access granted for user with different case "
"in case-sensitive domain");
"Access denied for user with different case "
"in case-sensitive domain");
}
{
struct tevent_req *req;
"Access granted for user not present in domain");
}
{
struct tevent_req *req;
"Access granted while group is in deny list.");
"Access denied while group is not in deny list.");
}
{
struct tevent_req *req;
"Access denied while user is in allow list.");
"Access granted while user is not in allow list.");
}
{
struct tevent_req *req;
"Access granted while user is in deny list.");
"Access granted while user is not in allow list.");
}
{
struct tevent_req *req;
"Access granted for user with different case "
"in case-sensitive domain");
"Access denied for user with different case "
"in case-sensitive domain");
}
{
int i;
}
}
}
void **pvt_data);
{
"another space@LOCAL", NULL};
"another space", NULL};
/* allow users */
"simple_allow_users", val);
/* deny users */
"simple_deny_users", val);
/* allow groups */
"simple_allow_groups", val);
/* deny groups */
"simple_deny_groups", val);
}
Suite *access_simple_suite (void)
{
suite_add_tcase(s, tc_init);
return s;
}
{
int opt;
int number_failed;
struct poptOption long_options[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
Suite *s = access_simple_suite();
if (number_failed == 0) {
}
}