Files
gluetun/internal/configuration/settings_test.go

67 lines
1.4 KiB
Go
Raw Normal View History

2021-02-06 11:05:50 -05:00
package configuration
import (
"testing"
"github.com/qdm12/gluetun/internal/constants"
"github.com/stretchr/testify/assert"
)
func Test_Settings_lines(t *testing.T) {
t.Parallel()
testCases := map[string]struct {
settings Settings
lines []string
}{
"default settings": {
settings: Settings{
VPN: VPN{
Type: constants.OpenVPN,
2021-02-06 11:05:50 -05:00
Provider: Provider{
Name: constants.Mullvad,
},
OpenVPN: OpenVPN{
Version: constants.Openvpn25,
},
2021-02-06 11:05:50 -05:00
},
},
lines: []string{
"Settings summary below:",
"|--VPN:",
" |--Type: openvpn",
" |--OpenVPN:",
" |--Version: 2.5",
" |--Verbosity level: 0",
" |--Mullvad settings:",
" |--OpenVPN selection:",
" |--Protocol: udp",
2021-02-06 11:05:50 -05:00
"|--DNS:",
"|--Firewall: disabled ⚠️",
"|--System:",
" |--Process user ID: 0",
" |--Process group ID: 0",
" |--Timezone: NOT SET ⚠️ - it can cause time related issues",
"|--Health:",
2021-07-22 20:45:17 +00:00
" |--Server address: ",
" |--OpenVPN:",
" |--Initial duration: 0s",
2021-02-06 11:05:50 -05:00
"|--HTTP control server:",
" |--Listening port: 0",
"|--Public IP getter: disabled",
},
},
}
for name, testCase := range testCases {
testCase := testCase
t.Run(name, func(t *testing.T) {
t.Parallel()
lines := testCase.settings.lines()
assert.Equal(t, testCase.lines, lines)
})
}
}