/*
Authors:
Petr Čech <pcech@redhat.com>
Copyright (C) 2017 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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include <stdarg.h>
#include <stdlib.h>
#include <pwd.h>
#include "tests/cmocka/common_mock.h"
#include "tests/cmocka/common_mock_sysdb_objects.h"
#include "tests/cmocka/common_mock_sdap.h"
#include "providers/ad/ad_common.h"
#include "providers/ldap/sdap_async_initgroups.c"
/* Declarations from providers/ldap/sdap_async_initgroups.c */
struct sdap_get_initgr_state;
struct sysdb_attrs **users,
NULL };
NULL };
NULL };
/* ====================== Utilities =============================== */
struct test_sdap_initgr_ctx {
};
{
for (int i = 0; test_users[i] != NULL; i++) {
user_count++;
}
for (int i = 0; i < user_count; i++) {
assert_non_null(passwds[i]);
}
return passwds;
}
{
for (int i = 0; object_bases[i] != NULL; i++) {
base_count++;
}
for (int i = 0; i < base_count; i++) {
assert_non_null(params[i]);
}
return params;
}
const char *domain_name)
{
break;
}
}
return dom;
}
const char **domain_names)
{
for (int i=0; domain_names[i] != NULL; i++) {
if (i == 0) {
} else {
}
}
return state;
}
/* TODO: This function is copied from test_nss_srv.c
* It could be fine move both to one place,
* for example src/tests/common_sysdb.c
*/
struct sss_domain_info *dom,
struct sysdb_attrs *attrs,
{
char *fqname;
return ENOMEM;
}
/* Prime the cache with a valid user */
return ret;
}
/* ====================== Setup =============================== */
{
TEST_CONF_DB, domains[0],
TEST_ID_PROVIDER, params[0]);
return 0;
}
{
return 0;
}
{
NULL };
return 0;
}
{
return 0;
}
/* ====================== The tests =============================== */
{
const char *user_name;
assert_int_equal(ret, 0);
assert_int_equal(ret, 0);
passwd_users[0]->pw_uid,
passwd_users[0]->pw_name);
assert_int_equal(ret, 0);
assert_int_equal(ret, 0);
}
{
const char *user_name;
assert_int_equal(ret, 0);
assert_int_equal(ret, 0);
assert_int_equal(ret, 0);
}
{
struct sdap_search_base *, 2);
&other_sdom->search_bases[0]);
assert_int_equal(ret, 0);
}
{
int rv;
int opt;
};
};
/* Set debug level to invalid value so we can decide 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 */
if (rv == 0) {
}
return rv;
}