Skip to content

Commit 9f4ce81

Browse files
Some unit tests for pluggable password hashing
1 parent bfc4891 commit 9f4ce81

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/src/rabbit_tests.erl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ all_tests0() ->
9292
passed = vm_memory_monitor_tests:all_tests(),
9393
passed = credit_flow_test:test_credit_flow_settings(),
9494
passed = on_disk_store_tunable_parameter_validation_test:test_msg_store_parameter_validation(),
95+
passed = test_password_hashing(),
9596
passed.
9697

9798
do_if_secondary_node(Up, Down) ->
@@ -1015,9 +1016,6 @@ test_user_management() ->
10151016
TestTags([administrator]),
10161017
TestTags([]),
10171018

1018-
%% hashing functions
1019-
%% TODO
1020-
10211019
%% vhost creation
10221020
ok = control_action(add_vhost, ["/testhost"]),
10231021
{error, {vhost_already_exists, _}} =
@@ -1060,6 +1058,19 @@ test_user_management() ->
10601058

10611059
passed.
10621060

1061+
test_password_hashing() ->
1062+
rabbit_password_hashing_sha256 = rabbit_password:hashing_mod(),
1063+
application:set_env(rabbit, password_hashing_module, rabbit_password_hashing_md5),
1064+
rabbit_password_hashing_md5 = rabbit_password:hashing_mod(),
1065+
application:set_env(rabbit, password_hashing_module, rabbit_password_hashing_sha256),
1066+
rabbit_password_hashing_sha256 = rabbit_password:hashing_mod(),
1067+
1068+
rabbit_password_hashing_sha256 = rabbit_password:hashing_mod(rabbit_password_hashing_sha256),
1069+
rabbit_password_hashing_md5 = rabbit_password:hashing_mod(rabbit_password_hashing_md5),
1070+
rabbit_password_hashing_md5 = rabbit_password:hashing_mod(undefined),
1071+
1072+
passed.
1073+
10631074
test_runtime_parameters() ->
10641075
rabbit_runtime_parameters_test:register(),
10651076
Good = fun(L) -> ok = control_action(set_parameter, L) end,

0 commit comments

Comments
 (0)