test_dyndns.c revision 9cb46bc62f22e0104f1b41a423b014c281ef5fc2
/*
Authors:
Jakub Hrozek <jhrozek@redhat.com>
Copyright (C) 2013 Red Hat
SSSD tests: Dynamic DNS 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 <talloc.h>
#include <tevent.h>
#include <errno.h>
#include <popt.h>
#include <unistd.h>
#include <ifaddrs.h>
/* In order to access opaque types */
#include "providers/dp_dyndns.c"
#include "tests/cmocka/common_mock.h"
#include "src/providers/dp_dyndns.h"
enum mock_nsupdate_states {
};
struct dyndns_test_ctx {
struct sss_test_ctx *tctx;
enum mock_nsupdate_states state;
int child_status;
int child_retval;
};
static struct dyndns_test_ctx *dyndns_test_ctx;
{
int err;
switch (dyndns_test_ctx->state) {
case MOCK_NSUPDATE_OK:
err = 0;
break;
case MOCK_NSUPDATE_ERR:
err = 1;
break;
case MOCK_NSUPDATE_TIMEOUT:
err = 2;
sleep(3);
break;
default:
err = 255;
break;
}
}
{
char *name;
char *straddr;
straddr = sss_mock_ptr_type(char *);
goto fail;
}
goto fail;
}
if (ifap_prev) {
} else {
}
goto fail;
}
goto fail;
}
/* convert straddr into ifa_addr */
goto fail;
}
}
return 0;
fail:
return -1;
}
{
}
{
struct dyndns_test_ctx *ctx =
}
{
if (ifname) {
}
}
void dyndns_test_get_ifaddr(void **state)
{
struct sss_iface_addr *addrlist;
char straddr[128];
/* There must be only one address with the correct value */
}
void dyndns_test_ok(void **state)
{
struct tevent_req *req;
discard_const("test message"));
/* Wait until the test finishes with EOK */
}
void dyndns_test_error(void **state)
{
struct tevent_req *req;
discard_const("test message"));
/* Wait until the test finishes with EIO (child error) */
}
void dyndns_test_timeout(void **state)
{
struct tevent_req *req;
discard_const("test message"));
/* Wait until the test finishes with EIO (child error) */
}
/* Testsuite setup and teardown */
void dyndns_test_setup(void **state)
{
}
void dyndns_test_teardown(void **state)
{
}
{
int rv;
int opt;
struct poptOption long_options[] = {
};
/* Utility functions unit test */
/* Dynamic DNS update unit tests*/
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
return rv;
}