mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-17 23:16:11 +08:00

Context: https://github.com/ipfs/kubo/issues/10187 Co-authored-by: Marcin Rataj <lidel@lidel.org>
23 lines
460 B
Go
23 lines
460 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConvertAuthSecret(t *testing.T) {
|
|
for _, testCase := range []struct {
|
|
input string
|
|
output string
|
|
}{
|
|
{"", ""},
|
|
{"someToken", "Bearer someToken"},
|
|
{"bearer:someToken", "Bearer someToken"},
|
|
{"basic:user:pass", "Basic dXNlcjpwYXNz"},
|
|
{"basic:dXNlcjpwYXNz", "Basic dXNlcjpwYXNz"},
|
|
} {
|
|
assert.Equal(t, testCase.output, ConvertAuthSecret(testCase.input))
|
|
}
|
|
}
|