Files
gluetun/internal/updater/mullvad_test.go
2020-10-20 02:45:28 +00:00

33 lines
774 B
Go

package updater
import (
"net"
"strings"
"testing"
"github.com/qdm12/gluetun/internal/models"
"github.com/stretchr/testify/assert"
)
func Test_stringifyMullvadServers(t *testing.T) {
servers := []models.MullvadServer{{
Country: "webland",
City: "webcity",
ISP: "not nsa",
Owned: true,
IPs: []net.IP{{1, 1, 1, 1}},
IPsV6: []net.IP{{1, 1, 1, 1}},
}}
//nolint:lll
expected := `
func MullvadServers() []models.MullvadServer {
return []models.MullvadServer{
{Country: "webland", City: "webcity", ISP: "not nsa", Owned: true, IPs: []net.IP{{1, 1, 1, 1}}, IPsV6: []net.IP{{1, 1, 1, 1}}},
}
}
`
expected = strings.TrimPrefix(strings.TrimSuffix(expected, "\n"), "\n")
s := stringifyMullvadServers(servers)
assert.Equal(t, expected, s)
}