2020-09-26 18:23:43 +00:00
|
|
|
package client
|
|
|
|
|
2020-10-04 23:49:02 +00:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
2020-09-26 18:23:43 +00:00
|
|
|
|
|
|
|
func TestGetHttpClient(t *testing.T) {
|
2020-10-04 21:01:10 +00:00
|
|
|
if secureHttpClient != nil {
|
|
|
|
t.Error("secureHttpClient should've been nil since it hasn't been called a single time yet")
|
2020-09-26 18:23:43 +00:00
|
|
|
}
|
2020-10-04 21:01:10 +00:00
|
|
|
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")
|
2020-09-26 18:23:43 +00:00
|
|
|
}
|
|
|
|
}
|