@@ -2,7 +2,9 @@ package api_test
22
33import (
44 "context"
5+ "io"
56 "net/http"
7+ "strings"
68 "testing"
79
810 "go.uber.org/mock/gomock"
@@ -45,21 +47,24 @@ func TestValidateAPIKeyWithClient(t *testing.T) {
4547 m .EXPECT ().
4648 GetProjectsProjectIdServicesWithResponse (gomock .Any (), "00000000-0000-0000-0000-000000000000" ).
4749 Return (& api.GetProjectsProjectIdServicesResponse {
48- HTTPResponse : & http.Response {StatusCode : 401 },
50+ HTTPResponse : & http.Response {StatusCode : 401 ,
51+ Body : io .NopCloser (strings .NewReader (`{"message":"Invalid or missing authentication credentials"}` ))},
4952 }, nil )
5053 },
51- expectedError : "invalid API key: authentication failed " ,
54+ expectedError : "Invalid or missing authentication credentials " ,
5255 },
5356 {
5457 name : "invalid API key - 403 response" ,
5558 setupMock : func (m * mocks.MockClientWithResponsesInterface ) {
5659 m .EXPECT ().
5760 GetProjectsProjectIdServicesWithResponse (gomock .Any (), "00000000-0000-0000-0000-000000000000" ).
5861 Return (& api.GetProjectsProjectIdServicesResponse {
59- HTTPResponse : & http.Response {StatusCode : 403 },
62+ HTTPResponse : & http.Response {StatusCode : 403 ,
63+ Body : io .NopCloser (strings .NewReader (`{"message":"Invalid or missing authentication credentials"}` )),
64+ },
6065 }, nil )
6166 },
62- expectedError : "invalid API key: authentication failed " ,
67+ expectedError : "Invalid or missing authentication credentials " ,
6368 },
6469 {
6570 name : "unexpected response - 500" ,
0 commit comments