diff options
author | John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> | 2023-04-13 17:16:24 +0200 |
---|---|---|
committer | John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> | 2023-04-18 14:28:20 +0200 |
commit | 07cc19ce10dcf1cbbdca4797540d4f2bea74b724 (patch) | |
tree | c82ade1b904636717a352b809652523b56bdacb6 /tests/unittests | |
parent | 9bce23e075e4ec4ad7c888688226c7136d5f9257 (diff) | |
download | profani-tty-07cc19ce10dcf1cbbdca4797540d4f2bea74b724.tar.gz |
Add sessions_alarm
Introduce new feature: sessions_alarm. Added new account setting: max_connections. On exceeding this number, user will get an alert. If number is less than 1, no alert will happen. Tests altered to fit new feature.
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/config/stub_accounts.c | 8 | ||||
-rw-r--r-- | tests/unittests/test_cmd_account.c | 14 | ||||
-rw-r--r-- | tests/unittests/test_cmd_connect.c | 8 | ||||
-rw-r--r-- | tests/unittests/test_cmd_join.c | 8 | ||||
-rw-r--r-- | tests/unittests/test_cmd_otr.c | 2 | ||||
-rw-r--r-- | tests/unittests/test_cmd_rooms.c | 4 |
6 files changed, 26 insertions, 18 deletions
diff --git a/tests/unittests/config/stub_accounts.c b/tests/unittests/config/stub_accounts.c index cea8a76a..e1f9ed09 100644 --- a/tests/unittests/config/stub_accounts.c +++ b/tests/unittests/config/stub_accounts.c @@ -183,6 +183,10 @@ accounts_set_theme(const char* const account_name, const char* const value) { } void +accounts_set_max_sessions(const char* const account_name, const int value) +{ +} +void accounts_set_tls_policy(const char* const account_name, const char* const value) { } @@ -314,6 +318,10 @@ accounts_clear_resource(const char* const account_name) { } void +accounts_clear_max_sessions(const char* const account_name) +{ +} +void accounts_add_otr_policy(const char* const account_name, const char* const contact_jid, const char* const policy) { } diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c index 2a65a875..76f5a594 100644 --- a/tests/unittests/test_cmd_account.c +++ b/tests/unittests/test_cmd_account.c @@ -34,7 +34,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void** state) { ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); gchar* args[] = { NULL }; will_return(connection_get_status, JABBER_CONNECTED); @@ -98,7 +98,7 @@ cmd_account_show_shows_account_when_exists(void** state) { gchar* args[] = { "show", "account_name", NULL }; ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); expect_any(accounts_get_account, name); will_return(accounts_get_account, account); @@ -437,7 +437,7 @@ cmd_account_set_password_sets_password(void** state) { gchar* args[] = { "set", "a_account", "password", "a_password", NULL }; ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -460,7 +460,7 @@ cmd_account_set_eval_password_sets_eval_password(void** state) { gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL }; ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -483,7 +483,7 @@ cmd_account_set_password_when_eval_password_set(void** state) { gchar* args[] = { "set", "a_account", "password", "a_password", NULL }; ProfAccount* account = account_new(g_strdup("a_account"), NULL, NULL, g_strdup("a_password"), - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -502,7 +502,7 @@ cmd_account_set_eval_password_when_password_set(void** state) { gchar* args[] = { "set", "a_account", "eval_password", "a_password", NULL }; ProfAccount* account = account_new(g_strdup("a_account"), NULL, g_strdup("a_password"), NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); expect_any(accounts_account_exists, account_name); will_return(accounts_account_exists, TRUE); @@ -853,7 +853,7 @@ cmd_account_set_priority_updates_presence_when_account_connected_with_presence(v #ifdef HAVE_LIBGPGME ProfAccount* account = account_new(g_strdup("a_account"), g_strdup("a_jid"), NULL, NULL, TRUE, NULL, 5222, g_strdup("a_resource"), - NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(session_get_account_name, "a_account"); expect_any(accounts_get_account, name); diff --git a/tests/unittests/test_cmd_connect.c b/tests/unittests/test_cmd_connect.c index 8def6b64..98e1884d 100644 --- a/tests/unittests/test_cmd_connect.c +++ b/tests/unittests/test_cmd_connect.c @@ -124,7 +124,7 @@ cmd_connect_lowercases_argument_with_account(void** state) { gchar* args[] = { "Jabber_org", NULL }; ProfAccount* account = account_new(g_strdup("Jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_DISCONNECTED); @@ -145,7 +145,7 @@ cmd_connect_asks_password_when_not_in_account(void** state) { gchar* args[] = { "jabber_org", NULL }; ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_DISCONNECTED); @@ -408,7 +408,7 @@ cmd_connect_shows_message_when_connecting_with_account(void** state) { gchar* args[] = { "jabber_org", NULL }; ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("user@jabber.org"), g_strdup("password"), NULL, - TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_DISCONNECTED); @@ -429,7 +429,7 @@ cmd_connect_connects_with_account(void** state) { gchar* args[] = { "jabber_org", NULL }; ProfAccount* account = account_new(g_strdup("jabber_org"), g_strdup("me@jabber.org"), g_strdup("password"), NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_DISCONNECTED); diff --git a/tests/unittests/test_cmd_join.c b/tests/unittests/test_cmd_join.c index 9d6c2eeb..77e3dc74 100644 --- a/tests/unittests/test_cmd_join.c +++ b/tests/unittests/test_cmd_join.c @@ -71,7 +71,7 @@ cmd_join_uses_account_mucservice_when_no_service_specified(void** state) char* expected_room = "room@conference.server.org"; gchar* args[] = { room, "nick", nick, NULL }; ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL, - TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); muc_init(); @@ -99,7 +99,7 @@ cmd_join_uses_supplied_nick(void** state) char* nick = "bob"; gchar* args[] = { room, "nick", nick, NULL }; ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL, - TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); muc_init(); @@ -127,7 +127,7 @@ cmd_join_uses_account_nick_when_not_supplied(void** state) char* account_nick = g_strdup("a_nick"); gchar* args[] = { room, NULL }; ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL, - TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); muc_init(); @@ -158,7 +158,7 @@ cmd_join_uses_password_when_supplied(void** state) char* expected_room = "room@a_service"; gchar* args[] = { room, "password", password, NULL }; ProfAccount* account = account_new(account_name, g_strdup("user@server.org"), NULL, NULL, - TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, g_strdup("laptop"), NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); muc_init(); diff --git a/tests/unittests/test_cmd_otr.c b/tests/unittests/test_cmd_otr.c index ae492cf1..d5136d97 100644 --- a/tests/unittests/test_cmd_otr.c +++ b/tests/unittests/test_cmd_otr.c @@ -196,7 +196,7 @@ cmd_otr_gen_generates_key_for_connected_account(void** state) gchar* args[] = { "gen", NULL }; char* account_name = g_strdup("myaccount"); ProfAccount* account = account_new(account_name, g_strdup("me@jabber.org"), NULL, NULL, - TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, account_name); diff --git a/tests/unittests/test_cmd_rooms.c b/tests/unittests/test_cmd_rooms.c index 60fca1ce..0800bf20 100644 --- a/tests/unittests/test_cmd_rooms.c +++ b/tests/unittests/test_cmd_rooms.c @@ -51,7 +51,7 @@ cmd_rooms_uses_account_default_when_no_arg(void** state) gchar* args[] = { NULL }; ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, - 0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + 0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, "account_name"); @@ -91,7 +91,7 @@ cmd_rooms_filter_arg_used_when_passed(void** state) gchar* args[] = { "filter", "text", NULL }; ProfAccount* account = account_new(g_strdup("testaccount"), NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, - 0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + 0, 0, 0, 0, 0, g_strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, "account_name"); |