mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Added cmd_connect tests for invalid properties
This commit is contained in:
parent
91d4097df9
commit
bd221f6f30
@ -238,6 +238,44 @@ void cmd_connect_shows_usage_when_port_provided_twice(void **state)
|
|||||||
free(help);
|
free(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_connect_shows_usage_when_invalid_first_property(void **state)
|
||||||
|
{
|
||||||
|
stub_ui_ask_password();
|
||||||
|
mock_cons_show();
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
help->usage = "some usage";
|
||||||
|
gchar *args[] = { "user@server.org", "wrong", "server", NULL };
|
||||||
|
|
||||||
|
mock_connection_status(JABBER_DISCONNECTED);
|
||||||
|
|
||||||
|
expect_cons_show("Usage: some usage");
|
||||||
|
expect_cons_show("");
|
||||||
|
|
||||||
|
gboolean result = cmd_connect(args, *help);
|
||||||
|
assert_true(result);
|
||||||
|
|
||||||
|
free(help);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_connect_shows_usage_when_invalid_second_property(void **state)
|
||||||
|
{
|
||||||
|
stub_ui_ask_password();
|
||||||
|
mock_cons_show();
|
||||||
|
CommandHelp *help = malloc(sizeof(CommandHelp));
|
||||||
|
help->usage = "some usage";
|
||||||
|
gchar *args[] = { "user@server.org", "server", "aserver", "wrong", "1234", NULL };
|
||||||
|
|
||||||
|
mock_connection_status(JABBER_DISCONNECTED);
|
||||||
|
|
||||||
|
expect_cons_show("Usage: some usage");
|
||||||
|
expect_cons_show("");
|
||||||
|
|
||||||
|
gboolean result = cmd_connect(args, *help);
|
||||||
|
assert_true(result);
|
||||||
|
|
||||||
|
free(help);
|
||||||
|
}
|
||||||
|
|
||||||
void cmd_connect_when_no_account(void **state)
|
void cmd_connect_when_no_account(void **state)
|
||||||
{
|
{
|
||||||
mock_cons_show();
|
mock_cons_show();
|
||||||
|
@ -23,3 +23,5 @@ void cmd_connect_with_port_when_provided(void **state);
|
|||||||
void cmd_connect_with_server_and_port_when_provided(void **state);
|
void cmd_connect_with_server_and_port_when_provided(void **state);
|
||||||
void cmd_connect_shows_usage_when_server_provided_twice(void **state);
|
void cmd_connect_shows_usage_when_server_provided_twice(void **state);
|
||||||
void cmd_connect_shows_usage_when_port_provided_twice(void **state);
|
void cmd_connect_shows_usage_when_port_provided_twice(void **state);
|
||||||
|
void cmd_connect_shows_usage_when_invalid_first_property(void **state);
|
||||||
|
void cmd_connect_shows_usage_when_invalid_second_property(void **state);
|
||||||
|
@ -192,6 +192,8 @@ int main(int argc, char* argv[]) {
|
|||||||
unit_test(cmd_connect_with_server_and_port_when_provided),
|
unit_test(cmd_connect_with_server_and_port_when_provided),
|
||||||
unit_test(cmd_connect_shows_usage_when_server_provided_twice),
|
unit_test(cmd_connect_shows_usage_when_server_provided_twice),
|
||||||
unit_test(cmd_connect_shows_usage_when_port_provided_twice),
|
unit_test(cmd_connect_shows_usage_when_port_provided_twice),
|
||||||
|
unit_test(cmd_connect_shows_usage_when_invalid_first_property),
|
||||||
|
unit_test(cmd_connect_shows_usage_when_invalid_second_property),
|
||||||
|
|
||||||
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),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user