-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #180: Rename authentication methods
This is a really dirt fix for issue #180. It will replace "well-known" enumerated plugin names with SASL mechanism names. While this is more of a "bandage" than the actual proper fix, I have currently found no better ways to do it. Most likely this issue will rise up again with another SASL plugin and we will deal with it then. At this stage, it should cover most of the use cases transparently.
- Loading branch information
Showing
4 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bats | ||
|
||
load /code/scripts/common.sh | ||
|
||
assert_equals() { | ||
local expected="$1" | ||
local actual="$2" | ||
if [[ "${expected}" != "${actual}" ]]; then | ||
echo "Expected: \"${expected}\". Got: \"${actual}\"." >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
@test "check if trim works properly" { | ||
assert_equals "bar" "$(echo "bar" | trim)" | ||
assert_equals "foo bar" "$(echo "foo bar" | trim)" | ||
assert_equals "foo bar" "$(echo " foo bar" | trim)" | ||
assert_equals "foo bar" "$(echo "foo bar " | trim)" | ||
assert_equals "foo bar" "$(echo " foo bar " | trim)" | ||
assert_equals "foo bar" "$(printf '%s' " foo bar" | trim)" | ||
assert_equals "foo bar" "$(printf '%s' $'\t\tfoo bar\r\n' | trim)" | ||
assert_equals "foo bar" "$(printf '%s' $' foo bar\r\n' | trim)" | ||
} | ||
|
||
@test "check if convert_plugin_names_to_filter_names works" { | ||
assert_equals "foo" "$(echo "foo" | convert_plugin_names_to_filter_names)" | ||
assert_equals "foo,bar" "$(echo "foo,bar" | convert_plugin_names_to_filter_names)" | ||
assert_equals "foo,bar,baz" "$(echo "foo, bar, baz," | convert_plugin_names_to_filter_names)" | ||
assert_equals "DIGEST-MD5" "$(echo "digestmd5" | convert_plugin_names_to_filter_names)" | ||
assert_equals "CRAM-MD5" "$(echo "crammd5" | convert_plugin_names_to_filter_names)" | ||
assert_equals "DIGEST-MD5,ntlm,CRAM-MD5,plain,login,anonymous" "$(echo "digestmd5,ntlm,crammd5,plain,login,anonymous" | convert_plugin_names_to_filter_names)" | ||
assert_equals "DIGEST-MD5,ntlm,CRAM-MD5,plain,login,anonymous" "$(echo "DIGESTMD5,ntlm,CRAMMD5,plain,login,anonymous" | convert_plugin_names_to_filter_names)" | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters