fix test on windows

This commit is contained in:
Cody Lee 2022-11-23 21:50:41 -06:00
parent d27fb7aba6
commit fad5b93717
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package unifi // nolint: testpackage
import ( import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"runtime"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -22,7 +23,11 @@ func TestNewUnifi(t *testing.T) {
authReq, err := NewUnifi(c) authReq, err := NewUnifi(c)
a.NotNil(err) a.NotNil(err)
a.EqualValues(u, authReq.URL) a.EqualValues(u, authReq.URL)
if runtime.GOOS == "windows" {
a.Contains(err.Error(), "connectex: No connection", "an invalid destination should produce a connection error.")
} else {
a.Contains(err.Error(), "connection refused", "an invalid destination should produce a connection error.") a.Contains(err.Error(), "connection refused", "an invalid destination should produce a connection error.")
}
} }
func TestUniReq(t *testing.T) { func TestUniReq(t *testing.T) {