gatus/client/client_test.go
TwinProduction 83a5813daf Work on #61: Add support for ICMP
+ Update dependencies
2020-12-25 00:07:18 -05:00

38 lines
1.0 KiB
Go

package client
import (
"testing"
)
func TestGetHttpClient(t *testing.T) {
if secureHTTPClient != nil {
t.Error("secureHTTPClient should've been nil since it hasn't been called a single time yet")
}
if insecureHTTPClient != nil {
t.Error("insecureHTTPClient should've been nil since it hasn't been called a single time yet")
}
_ = GetHTTPClient(false)
if secureHTTPClient == nil {
t.Error("secureHTTPClient shouldn't have been nil, since it has been called once")
}
if insecureHTTPClient != nil {
t.Error("insecureHTTPClient should've been nil since it hasn't been called a single time yet")
}
_ = GetHTTPClient(true)
if secureHTTPClient == nil {
t.Error("secureHTTPClient shouldn't have been nil, since it has been called once")
}
if insecureHTTPClient == nil {
t.Error("insecureHTTPClient shouldn't have been nil, since it has been called once")
}
}
func TestCanPing(t *testing.T) {
if !CanPing("127.0.0.1") {
t.Error("expected true")
}
if CanPing("256.256.256.256") {
t.Error("expected false")
}
}