test_fqnames.c revision be7eabee6b7eb8def2441bf5de4c6d4950c155bf
/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Fully Qualified Names Tests
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 <popt.h>
#include "db/sysdb_private.h"
#include "tests/cmocka/common_mock.h"
#define NAME "name"
#define DOMNAME "domname"
#define FLATNAME "flatname"
#define SPECIALNAME "[]{}();:'|\",<.>/?!#$%^&*_+~`"
#define PROVIDER "local"
#define CONNNAME "conn"
#define DOMNAME2 "domname2"
#define FLATNAME2 "flatname2"
#define SUBDOMNAME "subdomname"
#define SUBFLATNAME "subflatname"
const char *name,
const char *flatname,
struct sss_domain_info *parent,
struct sss_names_ctx *nctx)
{
struct sss_domain_info *dom;
/* just to make new_subdomain happy */
return dom;
}
struct fqdn_test_ctx {
struct sss_domain_info *dom;
struct sss_names_ctx *nctx;
};
void fqdn_test_setup(void **state)
{
struct fqdn_test_ctx *test_ctx;
}
void fqdn_test_teardown(void **state)
{
struct fqdn_test_ctx);
return;
}
}
void test_default(void **state)
{
struct fqdn_test_ctx);
char *fqdn;
const int fqdn_size = 255;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
{
struct fqdn_test_ctx);
char *fqdn;
const int fqdn_size = 255;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
{
struct fqdn_test_ctx);
char *fqdn;
const int fqdn_size = 255;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
}
void test_flat_fallback(void **state)
{
struct fqdn_test_ctx);
char *fqdn;
const int fqdn_size = 255;
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
/* If flat name is requested but does not exist, the code falls back to domain
* name
*/
}
struct parse_name_test_ctx {
struct sss_domain_info *dom;
struct sss_domain_info *subdom;
struct sss_names_ctx *nctx;
};
const char *full_name,
const char *default_domain,
const char exp_ret,
const char *exp_name,
const char *exp_domain)
{
if (exp_name) {
}
if (exp_domain) {
}
}
void parse_name_test_setup(void **state)
{
struct parse_name_test_ctx *test_ctx;
struct sss_domain_info *dom;
/* Init with an AD-style regex to be able to test flat name */
"(((?P<domain>[^\\\\]+)\\\\(?P<name>.+$))|" \
"((?P<name>[^@]+)@(?P<domain>.+$))|" \
"(^(?P<name>[^@\\\\]+)$))",
/* The setup is two domains, first one with no subdomains,
* second one with a single subdomain
*/
/* Create the subdomain, but don't add it yet, we want to be able to
* test sss_parse_name_for_domains() signaling that domains must be
* discovered
*/
}
void parse_name_test_teardown(void **state)
{
struct parse_name_test_ctx);
}
const char *input_name,
const char exp_ret,
const char *exp_name,
const char *exp_domain)
{
const char *domain_const = NULL;
const char *name_const = NULL;
if (exp_name) {
}
if (exp_domain) {
}
&domain_const, &name_const);
if (exp_name) {
}
if (exp_domain) {
}
}
void parse_name_plain(void **state)
{
struct parse_name_test_ctx);
int ret;
}
void parse_name_fqdn(void **state)
{
struct parse_name_test_ctx);
}
void parse_name_sub(void **state)
{
struct parse_name_test_ctx);
/* The subdomain name is valid, but not known */
/* Link the subdomain (simulating subdom handler) and retry */
}
void parse_name_flat(void **state)
{
struct parse_name_test_ctx);
/* Link the subdomain (simulating subdom handler) */
/* The subdomain name is valid, but not known */
}
void parse_name_default(void **state)
{
struct parse_name_test_ctx);
struct sss_domain_info *dom2;
/* Simulate uknown default domain */
}
void test_init_nouser(void **state)
{
struct fqdn_test_ctx);
return;
}
"(?P<name>[^@]+)@?(?P<domain>[^@]*$)",
/* Initialization with no user name must fail */
}
void sss_parse_name_fail(void **state)
{
struct parse_name_test_ctx);
}
{
int opt;
struct poptOption long_options[] = {
};
};
/* 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 */
}