mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added connection status tests for /otr gen
This commit is contained in:
parent
4eac5c0d43
commit
d1d80fc26b
@ -280,6 +280,46 @@ void cmd_otr_gen_shows_message_when_not_connected(void **state)
|
||||
free(help);
|
||||
}
|
||||
|
||||
static void test_with_command_and_connection_status(char *command, jabber_conn_status_t status)
|
||||
{
|
||||
mock_cons_show();
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
gchar *args[] = { command, NULL };
|
||||
|
||||
mock_connection_status(status);
|
||||
expect_cons_show("You are not currently connected.");
|
||||
|
||||
gboolean result = cmd_rooms(args, *help);
|
||||
assert_true(result);
|
||||
|
||||
free(help);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_disconnected(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_DISCONNECTED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_undefined(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_UNDEFINED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_started(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_STARTED);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_connecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_CONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_shows_message_when_disconnecting(void **state)
|
||||
{
|
||||
test_with_command_and_connection_status("gen", JABBER_DISCONNECTING);
|
||||
}
|
||||
|
||||
void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
||||
{
|
||||
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||
|
@ -17,6 +17,11 @@ void cmd_otr_warn_off_disables_unencrypted_warning(void **state);
|
||||
void cmd_otr_libver_shows_libotr_version(void **state);
|
||||
void cmd_otr_gen_shows_message_when_not_connected(void **state);
|
||||
void cmd_otr_gen_generates_key_for_connected_account(void **state);
|
||||
void cmd_otr_gen_shows_message_when_disconnected(void **state);
|
||||
void cmd_otr_gen_shows_message_when_undefined(void **state);
|
||||
void cmd_otr_gen_shows_message_when_started(void **state);
|
||||
void cmd_otr_gen_shows_message_when_connecting(void **state);
|
||||
void cmd_otr_gen_shows_message_when_disconnecting(void **state);
|
||||
#else
|
||||
void cmd_otr_shows_message_when_otr_unsupported(void **state);
|
||||
#endif
|
||||
|
@ -458,6 +458,11 @@ int main(int argc, char* argv[]) {
|
||||
unit_test(cmd_otr_libver_shows_libotr_version),
|
||||
unit_test(cmd_otr_gen_shows_message_when_not_connected),
|
||||
unit_test(cmd_otr_gen_generates_key_for_connected_account),
|
||||
unit_test(cmd_otr_gen_shows_message_when_disconnected),
|
||||
unit_test(cmd_otr_gen_shows_message_when_undefined),
|
||||
unit_test(cmd_otr_gen_shows_message_when_started),
|
||||
unit_test(cmd_otr_gen_shows_message_when_connecting),
|
||||
unit_test(cmd_otr_gen_shows_message_when_disconnecting),
|
||||
#else
|
||||
unit_test(cmd_otr_shows_message_when_otr_unsupported),
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user