client: simplify test with mock-responses

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-23 14:20:03 +02:00
parent 1d8c8e192f
commit 47fd987af2
93 changed files with 228 additions and 1087 deletions

View File

@@ -1,7 +1,6 @@
package client
import (
"bytes"
"context"
"errors"
"fmt"
@@ -105,10 +104,7 @@ func TestServiceLogs(t *testing.T) {
return nil, fmt.Errorf("%s not set in URL query properly. Expected '%s', got %s", key, expected, actual)
}
}
return &http.Response{
StatusCode: http.StatusOK,
Body: io.NopCloser(bytes.NewReader([]byte("response"))),
}, nil
return mockResponse(http.StatusOK, nil, "response")(req)
}))
assert.NilError(t, err)
body, err := client.ServiceLogs(context.Background(), "service_id", logCase.options)