Merge from develop

Merge from develop
This commit is contained in:
MassimilianoPinto
2014-10-20 09:03:11 +02:00
8 changed files with 98 additions and 43 deletions

View File

@ -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);

View File

@ -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");