Fix problems in tests, fix issue in server.c (bug 581)
This commit is contained in:
parent
6041a7e12f
commit
e8758d3678
@ -162,7 +162,7 @@ SERVER *server;
|
||||
server = allServers;
|
||||
while (server)
|
||||
{
|
||||
if (strcmp(server->unique_name, name) == 0)
|
||||
if (server->unique_name && strcmp(server->unique_name, name) == 0)
|
||||
break;
|
||||
server = server->next;
|
||||
}
|
||||
|
@ -63,13 +63,14 @@ char *status;
|
||||
ss_info_dassert(server == server_find_by_unique_name("uniquename"), "Should find by unique name.");
|
||||
ss_dfprintf(stderr, "\t..done\nTesting Status Setting for Server.");
|
||||
status = server_status(server);
|
||||
ss_info_dassert(0 == strcmp("Down", status), "Status of Server should be Down prior to being set.");
|
||||
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running by default.");
|
||||
if (NULL != status) free(status);
|
||||
server_set_status(server, SERVER_MASTER);
|
||||
status = server_status(server);
|
||||
ss_info_dassert(0 == strcmp("Master, Down", status), "Should find correct status.");
|
||||
ss_info_dassert(0 == strcmp("Master, Running", status), "Should find correct status.");
|
||||
server_clear_status(server, SERVER_MASTER);
|
||||
ss_info_dassert(0 == strcmp("Down", status), "Status of Server should be Down after status cleared.");
|
||||
status = server_status(server);
|
||||
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running after master status cleared.");
|
||||
if (NULL != status) free(status);
|
||||
ss_dfprintf(stderr, "\t..done\nRun Prints for Server and all Servers.");
|
||||
printServer(server);
|
||||
|
@ -41,7 +41,8 @@
|
||||
static int
|
||||
test1()
|
||||
{
|
||||
USERS *users;
|
||||
USERS *users;
|
||||
char *authdata;
|
||||
int result, count;
|
||||
|
||||
/* Poll tests */
|
||||
@ -52,13 +53,17 @@ int result, count;
|
||||
ss_dfprintf(stderr, "\t..done\nAdd a user");
|
||||
count = users_add(users, "username", "authorisation");
|
||||
ss_info_dassert(1 == count, "Should add one user");
|
||||
ss_info_dassert(strcmp("authorisation", users_fetch(users, "username")), "User authorisation should be correct");
|
||||
authdata = users_fetch(users, "username");
|
||||
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
|
||||
ss_info_dassert(0 == strcmp("authorisation", authdata), "User authorisation should be correct");
|
||||
ss_dfprintf(stderr, "\t..done\nPrint users");
|
||||
usersPrint(users);
|
||||
ss_dfprintf(stderr, "\t..done\nUpdate a user");
|
||||
count = users_update(users, "username", "newauth");
|
||||
ss_info_dassert(1 == count, "Should update just one user");
|
||||
ss_info_dassert(strcmp("newauth", users_fetch(users, "username")), "User authorisation should be correctly updated");
|
||||
authdata = users_fetch(users, "username");
|
||||
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
|
||||
ss_info_dassert(0 == strcmp("newauth", authdata), "User authorisation should be correctly updated");
|
||||
ss_dfprintf(stderr, "\t..done\nDelete a user.");
|
||||
count = users_delete(users, "username");
|
||||
ss_info_dassert(1 == count, "Should delete just one user");
|
||||
|
Loading…
x
Reference in New Issue
Block a user