test_ipa_idmap.c revision 4e5e846de22407f825fe3b4040d79606818a2419
/*
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2014 Red Hat
SSSD tests: Unit tests for id-mapping in the IPA provider
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 "tests/cmocka/common_mock.h"
#include "lib/idmap/sss_idmap.h"
#include "providers/ipa/ipa_common.h"
#include "providers/ldap/sdap_idmap.h"
#define BASE_RID 111
#define SECONDARY_BASE_RID 11223344
#define BASE_ID 123456
#define RANGE_SIZE 222222
void test_get_idmap_data_from_range(void **state)
{
char *dom_name;
char *sid;
struct sss_idmap_range range;
bool external_mapping;
size_t c;
struct test_data {
struct range_info r;
char *exp_dom_name;
char *exp_sid;
struct sss_idmap_range exp_range;
bool exp_external_mapping;
} d[] = {
/* working IPA_RANGE_LOCAL range */
/* working old-style IPA_RANGE_LOCAL range without range type */
/* old-style IPA_RANGE_LOCAL without SID and secondary base rid */
/* old-style range with SID and secondary base rid */
DOMAIN_SID, NULL},
/* working IPA_RANGE_AD_TRUST range */
/* working old-style IPA_RANGE_AD_TRUST range without range type */
/* working IPA_RANGE_AD_TRUST_POSIX range */
};
for (c = 0; d[c].exp_dom_name != NULL; c++) {
} else {
}
}
}
struct range_info ***range_list)
{
sss_mock_ptr_type(struct range_info **));
return EOK;
}
struct test_ctx {
struct sdap_idmap_ctx *idmap_ctx;
struct sdap_id_ctx *sdap_id_ctx;
};
{
struct range_info **range_list;
range_list[0]->secondary_base_rid = 0;
return range_list;
}
static int setup_idmap_ctx(void **state)
{
int ret;
struct sdap_id_ctx);
struct be_ctx);
struct sss_domain_info);
return 0;
}
static int teardown_idmap_ctx(void **state)
{
return 0;
}
void test_ipa_idmap_get_ranges_from_sysdb(void **state)
{
int ret;
DOMAIN_NAME, DOMAIN_SID, true);
DOMAIN_NAME, DOMAIN_SID, false);
}
{
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;
}
}
}