test_sss_idmap.c revision 6b57784f0f175275fd900eca21c77415e3a5ea52
/*
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Unit tests for libsss_idmap
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"
#define TEST_RANGE_MIN 200000
#define TEST_RANGE_MAX 399999
#define TEST_DOM_NAME "test.dom"
#define TEST_DOM_SID "S-1-5-21-123-456-789"
#define TEST_FIRST_RID 0
#define TEST_EXT_MAPPING true
#define TEST_2_RANGE_MIN 600000
#define TEST_2_RANGE_MAX 799999
#define TEST_2_DOM_NAME "test2.dom"
#define TEST_2_DOM_SID "S-1-5-21-987-654-321"
#define TEST_2_FIRST_RID 1000000
#define TEST_2_EXT_MAPPING true
#define TEST_OFFSET 1000000
#define TEST_OFFSET_STR "1000000"
struct test_ctx {
struct sss_idmap_ctx *idmap_ctx;
};
{
}
{
}
void test_sss_idmap_setup(void **state)
{
enum idmap_error_code err;
}
bool second_domain)
{
struct sss_idmap_range range;
enum idmap_error_code err;
const char *name;
const char *sid;
if (second_domain) {
} else {
sid = TEST_DOM_SID;
}
0, external_mapping);
}
void test_sss_idmap_setup_with_domains(void **state) {
setup_ranges(test_ctx, false, false);
}
void test_sss_idmap_setup_with_external_mappings(void **state) {
setup_ranges(test_ctx, true, false);
}
void test_sss_idmap_setup_with_both(void **state) {
setup_ranges(test_ctx, false, false);
setup_ranges(test_ctx, true, true);
}
void test_sss_idmap_teardown(void **state)
{
}
void test_add_domain(void **state)
{
enum idmap_error_code err;
struct sss_idmap_range range;
&range);
&range);
false);
false);
true);
false);
false);
true);
}
void test_map_id(void **state)
{
enum idmap_error_code err;
&id);
}
void test_map_id_external(void **state)
{
enum idmap_error_code err;
&id);
}
void test_check_sid_id(void **state)
{
enum idmap_error_code err;
TEST_RANGE_MIN-1);
}
void test_has_algorithmic(void **state)
{
bool use_id_mapping;
enum idmap_error_code err;
TEST_DOM_SID"1",
}
void test_has_algorithmic_by_name(void **state)
{
bool use_id_mapping;
enum idmap_error_code err;
TEST_DOM_NAME"1",
}
void test_sss_idmap_check_collision_ex(void **state)
{
enum idmap_error_code err;
/* Same name, different SID */
/* Same SID, different name */
/* Same SID and name, no overlaps */
/* Same SID and name, different mappings */
/* Same SID and name, Overlapping RID range */
false,
false);
/* Different SID and name, Overlapping RID range */
false,
false);
/* Overlapping ranges with no external mapping */
false,
false);
/* Overlapping ranges with external mapping */
true,
true);
}
{
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;
}
}
}