Compare commits

..

1 Commits

Author SHA1 Message Date
4a48f228a6 Add unit tests for forced encryption check function
All checks were successful
CI / Check spelling (pull_request) Successful in 17s
CI / Check coding style (pull_request) Successful in 32s
CI / Linux (ubuntu) (pull_request) Successful in 10m59s
CI / Linux (arch) (pull_request) Successful in 12m48s
CI / Linux (debian) (pull_request) Successful in 12m51s
2025-08-27 16:36:14 +02:00

View File

@@ -70,7 +70,8 @@ test_cmd_force_encryption_sets_policy_block(void** state)
char* args[] = { "policy", "block", NULL };
expect_cons_show("Force encryption policy has been set to \"block\".");
assert_true(cmd_force_encryption(NULL, CMD_FORCE_ENCRYPTION, args));
assert_string_equal(prefs_get_string(PREF_FORCE_ENCRYPTION_MODE), "block");
auto_gchar gchar* pref_force_enc_mode = prefs_get_string(PREF_FORCE_ENCRYPTION_MODE);
assert_string_equal(pref_force_enc_mode, "block");
}
// Test: /force-encryption policy resend-to-confirm sets resend mode.
@@ -80,7 +81,8 @@ test_cmd_force_encryption_sets_policy_resend(void** state)
char* args[] = { "policy", "resend-to-confirm", NULL };
expect_cons_show("Force encryption policy has been set to \"resend-to-confirm\".");
assert_true(cmd_force_encryption(NULL, CMD_FORCE_ENCRYPTION, args));
assert_string_equal(prefs_get_string(PREF_FORCE_ENCRYPTION_MODE), "resend-to-confirm");
auto_gchar gchar* pref_force_enc_mode = prefs_get_string(PREF_FORCE_ENCRYPTION_MODE);
assert_string_equal(pref_force_enc_mode, "resend-to-confirm");
}
// Test: Unencrypted message blocked when policy is block.