diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-26 18:42:05 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-26 18:42:39 +0200 |
| commit | 3c7bebf067c6e39b56becabef1432db62bdf3a3d (patch) | |
| tree | d889383a920a9b51563ccc9cd0bd94843cd90ad8 /test | |
| parent | 2115942b607ded3d75d9d6ebb93ee31ffacb5bc3 (diff) | |
| download | rabbitmq-server-git-3c7bebf067c6e39b56becabef1432db62bdf3a3d.tar.gz | |
unit_SUITE: Move auth_backend_internal_expand_topic_permission() from rabbitmq-common
The module it tests was already moved.
[#147436507]
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit_SUITE.erl | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/unit_SUITE.erl b/test/unit_SUITE.erl index 3e92158595..11af196449 100644 --- a/test/unit_SUITE.erl +++ b/test/unit_SUITE.erl @@ -32,6 +32,7 @@ groups() -> [ {parallel_tests, [parallel], [ arguments_parser, + auth_backend_internal_expand_topic_permission, {basic_header_handling, [parallel], [ write_table_with_invalid_existing_type, invalid_existing_headers, @@ -1002,3 +1003,37 @@ listing_plugins_from_multiple_directories(Config) -> exit({wrong_plugins_list, Got}) end, ok. + +auth_backend_internal_expand_topic_permission(_Config) -> + ExpandMap = #{<<"username">> => <<"guest">>, <<"vhost">> => <<"default">>}, + %% simple case + <<"services/default/accounts/guest/notifications">> = + rabbit_auth_backend_internal:expand_topic_permission( + <<"services/{vhost}/accounts/{username}/notifications">>, + ExpandMap + ), + %% replace variable twice + <<"services/default/accounts/default/guest/notifications">> = + rabbit_auth_backend_internal:expand_topic_permission( + <<"services/{vhost}/accounts/{vhost}/{username}/notifications">>, + ExpandMap + ), + %% nothing to replace + <<"services/accounts/notifications">> = + rabbit_auth_backend_internal:expand_topic_permission( + <<"services/accounts/notifications">>, + ExpandMap + ), + %% the expand map isn't defined + <<"services/{vhost}/accounts/{username}/notifications">> = + rabbit_auth_backend_internal:expand_topic_permission( + <<"services/{vhost}/accounts/{username}/notifications">>, + undefined + ), + %% the expand map is empty + <<"services/{vhost}/accounts/{username}/notifications">> = + rabbit_auth_backend_internal:expand_topic_permission( + <<"services/{vhost}/accounts/{username}/notifications">>, + #{} + ), + ok. |
