1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Test "/account list"

This commit is contained in:
James Booth 2013-12-15 23:07:53 +00:00
parent 683da12c3a
commit 6f060b583e
4 changed files with 32 additions and 2 deletions

View File

@ -7,6 +7,7 @@
#include <glib.h>
#include "xmpp/xmpp.h"
#include "ui/ui.h"
#include "command/commands.h"
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
@ -45,5 +46,27 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
gboolean result = cmd_account(args, *help);
assert_true(result);
free(help);
free(account);
}
void cmd_account_list_shows_accounts(void **state)
{
CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { "list" };
gchar **accounts = malloc(sizeof(gchar *) * 4);
accounts[0] = strdup("account1");
accounts[1] = strdup("account2");
accounts[2] = strdup("account3");
accounts[3] = NULL;
will_return(accounts_get_list, accounts);
expect_memory(cons_show_account_list, accounts, accounts, sizeof(accounts));
gboolean result = cmd_account(args, *help);
assert_true(result);
free(help);
}

View File

@ -1,2 +1,3 @@
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state);
void cmd_account_shows_account_when_connected_and_no_args(void **state);
void cmd_account_list_shows_accounts(void **state);

View File

@ -30,6 +30,7 @@ int main(int argc, char* argv[]) {
unit_test(cmd_account_shows_usage_when_not_connected_and_no_args),
unit_test(cmd_account_shows_account_when_connected_and_no_args),
unit_test(cmd_account_list_shows_accounts),
unit_test(cmd_rooms_shows_message_when_disconnected),
unit_test(cmd_rooms_shows_message_when_disconnecting),

View File

@ -250,7 +250,12 @@ void cons_show_login_success(ProfAccount *account) {}
void cons_show_software_version(const char * const jid,
const char * const presence, const char * const name,
const char * const version, const char * const os) {}
void cons_show_account_list(gchar **accounts) {}
void cons_show_account_list(gchar **accounts)
{
check_expected(accounts);
}
void cons_show_room_list(GSList *room, const char * const conference_node) {}
void cons_show_bookmarks(const GList *list) {}
void cons_show_disco_items(GSList *items, const char * const jid) {}