From e4e53d6e01642e0f4ca98d7fb41e20d39d045bfe Mon Sep 17 00:00:00 2001 From: MarcoPolo-PasTonMolo Date: Fri, 17 Jun 2022 15:43:54 +0300 Subject: Don't forget encryption status for OX and PGP. Use a pgp.enabled and ox.enabled array the same way that omemo.enabled is used. Fixes https://github.com/profanity-im/profanity/issues/1694 Fixes https://github.com/profanity-im/profanity/issues/733 --- tests/unittests/config/stub_accounts.c | 10 ++++++++++ tests/unittests/test_cmd_account.c | 14 +++++++------- tests/unittests/test_cmd_connect.c | 8 ++++---- tests/unittests/test_cmd_join.c | 8 ++++---- tests/unittests/test_cmd_otr.c | 2 +- tests/unittests/test_cmd_rooms.c | 4 ++-- 6 files changed, 28 insertions(+), 18 deletions(-) (limited to 'tests/unittests') diff --git a/tests/unittests/config/stub_accounts.c b/tests/unittests/config/stub_accounts.c index 653b2897..08b934d9 100644 --- a/tests/unittests/config/stub_accounts.c +++ b/tests/unittests/config/stub_accounts.c @@ -318,3 +318,13 @@ void accounts_add_omemo_state(const char* const account_name, const char* const contact_jid, gboolean enabled) { } + +void +accounts_add_pgp_state(const char* const account_name, const char* const contact_jid, gboolean enabled) +{ +} + +void +accounts_add_ox_state(const char* const account_name, const char* const contact_jid, gboolean enabled) +{ +} diff --git a/tests/unittests/test_cmd_account.c b/tests/unittests/test_cmd_account.c index c0eac0e3..04215e88 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("jabber_org", "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); + 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); 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("jabber_org", "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); + 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); 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("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); + 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); 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("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); + 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); 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("a_account", NULL, NULL, "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); + 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); 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("a_account", NULL, "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); + 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); 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("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "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, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 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 63f08f6d..d167a5e9 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("Jabber_org", "me@jabber.org", "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); + 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); 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("jabber_org", "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); + 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); 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("jabber_org", "user@jabber.org", "password", NULL, - TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 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("jabber_org", "me@jabber.org", "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); + 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); will_return(connection_get_status, JABBER_DISCONNECTED); diff --git a/tests/unittests/test_cmd_join.c b/tests/unittests/test_cmd_join.c index c4af4040..92766cea 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, "user@server.org", NULL, NULL, - TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, "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); 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, "user@server.org", NULL, NULL, - TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); muc_init(); @@ -127,7 +127,7 @@ cmd_join_uses_account_nick_when_not_supplied(void** state) char* account_nick = "a_nick"; gchar* args[] = { room, NULL }; ProfAccount* account = account_new(account_name, "user@server.org", NULL, NULL, - TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, NULL, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, "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); 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, "user@server.org", NULL, NULL, - TRUE, NULL, 0, "laptop", NULL, NULL, 0, 0, 0, 0, 0, account_service, account_nick, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + TRUE, NULL, 0, "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); muc_init(); diff --git a/tests/unittests/test_cmd_otr.c b/tests/unittests/test_cmd_otr.c index 7dcc1767..9fd822ae 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 = "myaccount"; ProfAccount* account = account_new(account_name, "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); + 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); 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 8cdc27b2..22c16435 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("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, - 0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + 0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 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("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, - 0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + 0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); will_return(connection_get_status, JABBER_CONNECTED); will_return(session_get_account_name, "account_name"); -- cgit 1.4.1-2-gfad0