@@ -138,15 +138,15 @@ func TestPublishEndpoint(t *testing.T) {
138138 name : "missing authorization header" ,
139139 requestBody : model.PublishRequest {},
140140 authHeader : "" ,
141- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {},
141+ setupMocks : func (_ * MockRegistryService , _ * MockAuthService ) {},
142142 expectedStatus : http .StatusUnprocessableEntity ,
143143 expectedError : "required header parameter is missing" ,
144144 },
145145 {
146146 name : "invalid authorization header format" ,
147147 requestBody : model.PublishRequest {},
148148 authHeader : "InvalidFormat" ,
149- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {},
149+ setupMocks : func (_ * MockRegistryService , _ * MockAuthService ) {},
150150 expectedStatus : http .StatusUnauthorized ,
151151 expectedError : "Invalid Authorization header format" ,
152152 },
@@ -167,7 +167,7 @@ func TestPublishEndpoint(t *testing.T) {
167167 },
168168 },
169169 authHeader : "Bearer token" ,
170- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {},
170+ setupMocks : func (_ * MockRegistryService , _ * MockAuthService ) {},
171171 expectedStatus : http .StatusBadRequest ,
172172 expectedError : "Name is required" ,
173173 },
@@ -188,7 +188,7 @@ func TestPublishEndpoint(t *testing.T) {
188188 },
189189 },
190190 authHeader : "Bearer token" ,
191- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {},
191+ setupMocks : func (_ * MockRegistryService , _ * MockAuthService ) {},
192192 expectedStatus : http .StatusBadRequest ,
193193 expectedError : "Version is required" ,
194194 },
@@ -209,7 +209,7 @@ func TestPublishEndpoint(t *testing.T) {
209209 },
210210 },
211211 authHeader : "Bearer token" ,
212- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {
212+ setupMocks : func (_ * MockRegistryService , authSvc * MockAuthService ) {
213213 authSvc .On ("ValidateAuth" , mock .Anything , mock .Anything ).Return (false , auth .ErrAuthRequired )
214214 },
215215 expectedStatus : http .StatusUnauthorized ,
@@ -232,7 +232,7 @@ func TestPublishEndpoint(t *testing.T) {
232232 },
233233 },
234234 authHeader : "Bearer invalid_token" ,
235- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {
235+ setupMocks : func (_ * MockRegistryService , authSvc * MockAuthService ) {
236236 authSvc .On ("ValidateAuth" , mock .Anything , mock .Anything ).Return (false , nil )
237237 },
238238 expectedStatus : http .StatusUnauthorized ,
@@ -266,7 +266,7 @@ func TestPublishEndpoint(t *testing.T) {
266266 name : "method not allowed" ,
267267 requestBody : nil ,
268268 authHeader : "" ,
269- setupMocks : func (registry * MockRegistryService , authSvc * MockAuthService ) {},
269+ setupMocks : func (_ * MockRegistryService , _ * MockAuthService ) {},
270270 expectedStatus : http .StatusMethodNotAllowed ,
271271 expectedError : "Method Not Allowed" ,
272272 },
@@ -366,7 +366,7 @@ func TestPublishEndpoint(t *testing.T) {
366366 if tc .name == "method not allowed" {
367367 method = http .MethodGet
368368 }
369- req , err := http .NewRequest ( method , "/v0/publish" , bytes .NewBuffer (requestBody ))
369+ req , err := http .NewRequestWithContext ( context . Background (), method , "/v0/publish" , bytes .NewBuffer (requestBody ))
370370 assert .NoError (t , err )
371371 if method == http .MethodPost {
372372 req .Header .Set ("Content-Type" , "application/json" )
@@ -454,7 +454,7 @@ func TestPublishEndpointBearerTokenParsing(t *testing.T) {
454454 requestBody , err := json .Marshal (serverDetail )
455455 assert .NoError (t , err )
456456
457- req , err := http .NewRequest ( http .MethodPost , "/v0/publish" , bytes .NewBuffer (requestBody ))
457+ req , err := http .NewRequestWithContext ( context . Background (), http .MethodPost , "/v0/publish" , bytes .NewBuffer (requestBody ))
458458 assert .NoError (t , err )
459459 req .Header .Set ("Authorization" , tc .authHeader )
460460 req .Header .Set ("Content-Type" , "application/json" )
@@ -524,7 +524,7 @@ func TestPublishEndpointAuthMethodSelection(t *testing.T) {
524524 requestBody , err := json .Marshal (serverDetail )
525525 assert .NoError (t , err )
526526
527- req , err := http .NewRequest ( http .MethodPost , "/v0/publish" , bytes .NewBuffer (requestBody ))
527+ req , err := http .NewRequestWithContext ( context . Background (), http .MethodPost , "/v0/publish" , bytes .NewBuffer (requestBody ))
528528 assert .NoError (t , err )
529529 req .Header .Set ("Authorization" , "Bearer test_token" )
530530 req .Header .Set ("Content-Type" , "application/json" )
0 commit comments