2021-05-23 17:40:14 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_CipherLines(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
testCases := map[string]struct {
|
2021-10-05 20:36:23 +00:00
|
|
|
ciphers []string
|
2021-05-23 17:40:14 +00:00
|
|
|
version string
|
|
|
|
|
lines []string
|
|
|
|
|
}{
|
|
|
|
|
"empty version": {
|
2021-10-05 20:36:23 +00:00
|
|
|
ciphers: []string{"AES"},
|
2021-05-23 17:40:14 +00:00
|
|
|
lines: []string{
|
|
|
|
|
"data-ciphers-fallback AES",
|
|
|
|
|
"data-ciphers AES",
|
|
|
|
|
},
|
|
|
|
|
},
|
2021-05-31 18:54:36 +00:00
|
|
|
"2.5": {
|
2021-10-05 20:36:23 +00:00
|
|
|
ciphers: []string{"AES", "CBC"},
|
2021-05-31 18:54:36 +00:00
|
|
|
version: "2.5",
|
2021-05-23 17:40:14 +00:00
|
|
|
lines: []string{
|
|
|
|
|
"data-ciphers-fallback AES",
|
2021-10-05 20:36:23 +00:00
|
|
|
"data-ciphers AES:CBC",
|
2021-05-23 17:40:14 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
for name, testCase := range testCases {
|
|
|
|
|
t.Run(name, func(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
2023-05-21 13:10:38 +00:00
|
|
|
lines := CipherLines(testCase.ciphers)
|
2021-05-23 17:40:14 +00:00
|
|
|
|
|
|
|
|
assert.Equal(t, testCase.lines, lines)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|