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:
parent
683da12c3a
commit
6f060b583e
@ -7,6 +7,7 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
#include "command/commands.h"
|
#include "command/commands.h"
|
||||||
|
|
||||||
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
|
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
|
||||||
@ -32,7 +33,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
|
|||||||
gchar *args[] = { NULL };
|
gchar *args[] = { NULL };
|
||||||
|
|
||||||
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
will_return(jabber_get_connection_status, JABBER_CONNECTED);
|
||||||
|
|
||||||
will_return(jabber_get_account_name, "account_name");
|
will_return(jabber_get_account_name, "account_name");
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, "account_name");
|
expect_string(accounts_get_account, name, "account_name");
|
||||||
@ -45,5 +46,27 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
|
|||||||
gboolean result = cmd_account(args, *help);
|
gboolean result = cmd_account(args, *help);
|
||||||
assert_true(result);
|
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);
|
free(help);
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state);
|
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_shows_account_when_connected_and_no_args(void **state);
|
||||||
|
void cmd_account_list_shows_accounts(void **state);
|
||||||
|
@ -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_usage_when_not_connected_and_no_args),
|
||||||
unit_test(cmd_account_shows_account_when_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_disconnected),
|
||||||
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
unit_test(cmd_rooms_shows_message_when_disconnecting),
|
||||||
|
@ -250,7 +250,12 @@ void cons_show_login_success(ProfAccount *account) {}
|
|||||||
void cons_show_software_version(const char * const jid,
|
void cons_show_software_version(const char * const jid,
|
||||||
const char * const presence, const char * const name,
|
const char * const presence, const char * const name,
|
||||||
const char * const version, const char * const os) {}
|
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_room_list(GSList *room, const char * const conference_node) {}
|
||||||
void cons_show_bookmarks(const GList *list) {}
|
void cons_show_bookmarks(const GList *list) {}
|
||||||
void cons_show_disco_items(GSList *items, const char * const jid) {}
|
void cons_show_disco_items(GSList *items, const char * const jid) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user