2021-07-31 14:53:34 +00:00
|
|
|
package constants
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2021-08-27 19:10:03 +00:00
|
|
|
"github.com/golang/mock/gomock"
|
|
|
|
|
"github.com/qdm12/gluetun/internal/storage"
|
|
|
|
|
"github.com/qdm12/golibs/logging/mock_logging"
|
2021-07-31 14:53:34 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2021-08-27 19:10:03 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
2021-07-31 14:53:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_CyberghostGroupChoices(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
2021-08-27 19:10:03 +00:00
|
|
|
ctrl := gomock.NewController(t)
|
|
|
|
|
|
|
|
|
|
logger := mock_logging.NewMockLogger(ctrl)
|
|
|
|
|
logger.EXPECT().Info(gomock.Any())
|
|
|
|
|
|
|
|
|
|
storage, err := storage.New(logger, "")
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
|
|
servers := storage.GetServers()
|
2021-07-31 14:53:34 +00:00
|
|
|
|
|
|
|
|
expected := []string{"Premium TCP Asia", "Premium TCP Europe",
|
|
|
|
|
"Premium TCP USA", "Premium UDP Asia", "Premium UDP Europe",
|
|
|
|
|
"Premium UDP USA"}
|
2021-08-27 19:10:03 +00:00
|
|
|
choices := CyberghostGroupChoices(servers.GetCyberghost())
|
2021-07-31 14:53:34 +00:00
|
|
|
|
|
|
|
|
assert.Equal(t, expected, choices)
|
|
|
|
|
}
|