2020-09-26 20:23:43 +02:00
|
|
|
package client
|
|
|
|
|
2020-10-05 01:49:02 +02:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
2020-09-26 20:23:43 +02:00
|
|
|
|
|
|
|
func TestGetHttpClient(t *testing.T) {
|
2020-10-23 22:29:20 +02:00
|
|
|
if secureHTTPClient != nil {
|
|
|
|
t.Error("secureHTTPClient should've been nil since it hasn't been called a single time yet")
|
2020-09-26 20:23:43 +02:00
|
|
|
}
|
2020-10-23 22:29:20 +02:00
|
|
|
if insecureHTTPClient != nil {
|
|
|
|
t.Error("insecureHTTPClient should've been nil since it hasn't been called a single time yet")
|
2020-10-04 23:01:10 +02:00
|
|
|
}
|
2020-10-23 22:29:20 +02:00
|
|
|
_ = GetHTTPClient(false)
|
|
|
|
if secureHTTPClient == nil {
|
|
|
|
t.Error("secureHTTPClient shouldn't have been nil, since it has been called once")
|
2020-10-04 23:01:10 +02:00
|
|
|
}
|
2020-10-23 22:29:20 +02:00
|
|
|
if insecureHTTPClient != nil {
|
|
|
|
t.Error("insecureHTTPClient should've been nil since it hasn't been called a single time yet")
|
2020-10-04 23:01:10 +02:00
|
|
|
}
|
2020-10-23 22:29:20 +02:00
|
|
|
_ = GetHTTPClient(true)
|
|
|
|
if secureHTTPClient == nil {
|
|
|
|
t.Error("secureHTTPClient shouldn't have been nil, since it has been called once")
|
2020-10-04 23:01:10 +02:00
|
|
|
}
|
2020-10-23 22:29:20 +02:00
|
|
|
if insecureHTTPClient == nil {
|
|
|
|
t.Error("insecureHTTPClient shouldn't have been nil, since it has been called once")
|
2020-09-26 20:23:43 +02:00
|
|
|
}
|
|
|
|
}
|