fix(test): ajuster TLS client voki selon config

This commit is contained in:
Victor Lacasse-Beaudoin 2024-07-03 20:53:17 -04:00
parent 4ce3d9f60b
commit a9f1682634

View file

@ -22,7 +22,15 @@ func TestAPI(t *testing.T) {
httpClient := http.DefaultClient httpClient := http.DefaultClient
defer httpClient.CloseIdleConnections() defer httpClient.CloseIdleConnections()
vokiClient := voki.New(httpClient, "localhost", cfg.API.Key, cfg.API.Port, "http") var protocol string
switch cfg.API.TLS.Enabled {
case true:
protocol = "https"
case false:
protocol = "http"
}
vokiClient := voki.New(httpClient, "localhost", cfg.API.Key, cfg.API.Port, protocol)
apiClient := APIClient{vokiClient} apiClient := APIClient{vokiClient}
t.Run("get API health", func(t *testing.T) { t.Run("get API health", func(t *testing.T) {