Skip to content

Commit 03f8b71

Browse files
committed
Add missing imports; change tests
1 parent 104d81d commit 03f8b71

File tree

115 files changed

+341
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+341
-258
lines changed

access_requests.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"time"
2223
)
2324

access_requests_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestListProjectAccessRequests(t *testing.T) {
3131
defer teardown(server)
3232

3333
mux.HandleFunc("/api/v4/projects/1/access_requests", func(w http.ResponseWriter, r *http.Request) {
34-
testMethod(t, r, "GET")
34+
testMethod(t, r, http.MethodGet)
3535
fmt.Fprintf(w, `[
3636
{
3737
"id": 1,
@@ -98,7 +98,7 @@ func TestListGroupAccessRequests(t *testing.T) {
9898
defer teardown(server)
9999

100100
mux.HandleFunc("/api/v4/groups/1/access_requests", func(w http.ResponseWriter, r *http.Request) {
101-
testMethod(t, r, "GET")
101+
testMethod(t, r, http.MethodGet)
102102
fmt.Fprintf(w, `[
103103
{
104104
"id": 1,
@@ -165,7 +165,7 @@ func TestRequestProjectAccess(t *testing.T) {
165165
defer teardown(server)
166166

167167
mux.HandleFunc("/api/v4/projects/1/access_requests", func(w http.ResponseWriter, r *http.Request) {
168-
testMethod(t, r, "POST")
168+
testMethod(t, r, http.MethodPost)
169169
fmt.Fprintf(w, `{
170170
"id": 1,
171171
"username": "raymond_smith",
@@ -212,7 +212,7 @@ func TestRequestGroupAccess(t *testing.T) {
212212
defer teardown(server)
213213

214214
mux.HandleFunc("/api/v4/groups/1/access_requests", func(w http.ResponseWriter, r *http.Request) {
215-
testMethod(t, r, "POST")
215+
testMethod(t, r, http.MethodPost)
216216
fmt.Fprintf(w, `{
217217
"id": 1,
218218
"username": "raymond_smith",
@@ -259,7 +259,7 @@ func TestApproveProjectAccessRequest(t *testing.T) {
259259
defer teardown(server)
260260

261261
mux.HandleFunc("/api/v4/projects/1/access_requests/10/approve", func(w http.ResponseWriter, r *http.Request) {
262-
testMethod(t, r, "PUT")
262+
testMethod(t, r, http.MethodPut)
263263

264264
var opt ApproveAccessRequestOptions
265265
err := json.NewDecoder(r.Body).Decode(&opt)
@@ -319,7 +319,7 @@ func TestApproveGroupAccessRequest(t *testing.T) {
319319
defer teardown(server)
320320

321321
mux.HandleFunc("/api/v4/groups/1/access_requests/10/approve", func(w http.ResponseWriter, r *http.Request) {
322-
testMethod(t, r, "PUT")
322+
testMethod(t, r, http.MethodPut)
323323

324324
var opt ApproveAccessRequestOptions
325325
err := json.NewDecoder(r.Body).Decode(&opt)
@@ -379,7 +379,7 @@ func TestDenyProjectAccessRequest(t *testing.T) {
379379
defer teardown(server)
380380

381381
mux.HandleFunc("/api/v4/projects/1/access_requests/10", func(w http.ResponseWriter, r *http.Request) {
382-
testMethod(t, r, "DELETE")
382+
testMethod(t, r, http.MethodDelete)
383383
})
384384

385385
resp, err := client.AccessRequests.DenyProjectAccessRequest(1, 10)
@@ -404,7 +404,7 @@ func TestDenyGroupAccessRequest(t *testing.T) {
404404
defer teardown(server)
405405

406406
mux.HandleFunc("/api/v4/groups/1/access_requests/10", func(w http.ResponseWriter, r *http.Request) {
407-
testMethod(t, r, "DELETE")
407+
testMethod(t, r, http.MethodDelete)
408408
})
409409

410410
resp, err := client.AccessRequests.DenyGroupAccessRequest(1, 10)

applications_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestCreateApplication(t *testing.T) {
2929

3030
mux.HandleFunc("/api/v4/applications",
3131
func(w http.ResponseWriter, r *http.Request) {
32-
testMethod(t, r, "POST")
32+
testMethod(t, r, http.MethodPost)
3333
fmt.Fprint(w, `
3434
{
3535
"id":1,
@@ -61,7 +61,7 @@ func TestListApplications(t *testing.T) {
6161

6262
mux.HandleFunc("/api/v4/applications",
6363
func(w http.ResponseWriter, r *http.Request) {
64-
testMethod(t, r, "GET")
64+
testMethod(t, r, http.MethodGet)
6565
fmt.Fprint(w, `[
6666
{"id":1},
6767
{"id":2}
@@ -89,7 +89,7 @@ func TestDeleteApplication(t *testing.T) {
8989

9090
mux.HandleFunc("/api/v4/applications/4",
9191
func(w http.ResponseWriter, r *http.Request) {
92-
testMethod(t, r, "DELETE")
92+
testMethod(t, r, http.MethodDelete)
9393
w.WriteHeader(http.StatusAccepted)
9494
},
9595
)

audit_events.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gitlab
22

33
import (
44
"fmt"
5+
"net/http"
56
"time"
67
)
78

award_emojis.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"time"
2223
)
2324

boards.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
)
2223

2324
// IssueBoardsService handles communication with the issue board related

branches.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"net/url"
2223
)
2324

branches_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestGetBranch(t *testing.T) {
2929
defer teardown(server)
3030

3131
mux.HandleFunc("/api/v4/projects/1/repository/branches/master", func(w http.ResponseWriter, r *http.Request) {
32-
testMethod(t, r, "GET")
32+
testMethod(t, r, http.MethodGet)
3333
mustWriteHTTPResponse(t, w, "testdata/get_branch.json")
3434
})
3535

broadcast_messages.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"time"
2223
)
2324

broadcast_messages_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestListBroadcastMessages(t *testing.T) {
2929
defer teardown(server)
3030

3131
mux.HandleFunc("/api/v4/broadcast_messages", func(w http.ResponseWriter, r *http.Request) {
32-
testMethod(t, r, "GET")
32+
testMethod(t, r, http.MethodGet)
3333
fmt.Fprintf(w, `[{
3434
"message": "Some Message",
3535
"starts_at": "2017-06-26T06:00:00.000Z",
@@ -88,7 +88,7 @@ func TestGetBroadcastMessages(t *testing.T) {
8888
defer teardown(server)
8989

9090
mux.HandleFunc("/api/v4/broadcast_messages/1/", func(w http.ResponseWriter, r *http.Request) {
91-
testMethod(t, r, "GET")
91+
testMethod(t, r, http.MethodGet)
9292
fmt.Fprintf(w, `{
9393
"message": "Some Message",
9494
"starts_at": "2017-06-26T06:00:00.000Z",
@@ -130,7 +130,7 @@ func TestCreateBroadcastMessages(t *testing.T) {
130130
wantedEndsAt := time.Date(2017, time.June, 27, 12, 59, 0, 0, time.UTC)
131131

132132
mux.HandleFunc("/api/v4/broadcast_messages", func(w http.ResponseWriter, r *http.Request) {
133-
testMethod(t, r, "POST")
133+
testMethod(t, r, http.MethodPost)
134134
fmt.Fprintf(w, `{
135135
"message": "Some Message",
136136
"starts_at": "2017-06-26T06:00:00.000Z",
@@ -178,7 +178,7 @@ func TestUpdateBroadcastMessages(t *testing.T) {
178178
wantedEndsAt := time.Date(2017, time.June, 27, 12, 59, 0, 0, time.UTC)
179179

180180
mux.HandleFunc("/api/v4/broadcast_messages/1", func(w http.ResponseWriter, r *http.Request) {
181-
testMethod(t, r, "PUT")
181+
testMethod(t, r, http.MethodPut)
182182
fmt.Fprintf(w, `{
183183
"message": "Some Message Updated",
184184
"starts_at": "2017-06-26T06:00:00.000Z",
@@ -223,7 +223,7 @@ func TestDeleteBroadcastMessages(t *testing.T) {
223223
defer teardown(server)
224224

225225
mux.HandleFunc("/api/v4/broadcast_messages/1", func(w http.ResponseWriter, r *http.Request) {
226-
testMethod(t, r, "DELETE")
226+
testMethod(t, r, http.MethodDelete)
227227
})
228228

229229
_, err := client.BroadcastMessage.DeleteBroadcastMessage(1)

ci_yml_templates.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
)
2223

2324
// CIYMLTemplatesService handles communication with the gitlab

commits.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"net/url"
2223
"time"
2324
)

commits_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestGetCommit(t *testing.T) {
3737
defer teardown(server)
3838

3939
mux.HandleFunc("/api/v4/projects/1/repository/commits/b0b3a907f41409829b307a28b82fdbd552ee5a27", func(w http.ResponseWriter, r *http.Request) {
40-
testMethod(t, r, "GET")
40+
testMethod(t, r, http.MethodGet)
4141
mustWriteHTTPResponse(t, w, "testdata/get_commit.json")
4242
})
4343

@@ -80,7 +80,7 @@ func TestGetCommitStatuses(t *testing.T) {
8080
defer teardown(server)
8181

8282
mux.HandleFunc("/api/v4/projects/1/repository/commits/b0b3a907f41409829b307a28b82fdbd552ee5a27/statuses", func(w http.ResponseWriter, r *http.Request) {
83-
testMethod(t, r, "GET")
83+
testMethod(t, r, http.MethodGet)
8484
fmt.Fprint(w, `[{"id":1}]`)
8585
})
8686

@@ -107,7 +107,7 @@ func TestSetCommitStatus(t *testing.T) {
107107
defer teardown(server)
108108

109109
mux.HandleFunc("/api/v4/projects/1/statuses/b0b3a907f41409829b307a28b82fdbd552ee5a27", func(w http.ResponseWriter, r *http.Request) {
110-
testMethod(t, r, "POST")
110+
testMethod(t, r, http.MethodPost)
111111
body, err := ioutil.ReadAll(r.Body)
112112
require.NoError(t, err)
113113

@@ -147,7 +147,7 @@ func TestRevertCommit_NoOptions(t *testing.T) {
147147
defer teardown(server)
148148

149149
mux.HandleFunc("/api/v4/projects/1/repository/commits/b0b3a907f41409829b307a28b82fdbd552ee5a27/revert", func(w http.ResponseWriter, r *http.Request) {
150-
testMethod(t, r, "POST")
150+
testMethod(t, r, http.MethodPost)
151151
mustWriteHTTPResponse(t, w, "testdata/get_commit.json")
152152
})
153153

@@ -190,7 +190,7 @@ func TestRevertCommit_WithOptions(t *testing.T) {
190190
defer teardown(server)
191191

192192
mux.HandleFunc("/api/v4/projects/1/repository/commits/b0b3a907f41409829b307a28b82fdbd552ee5a27/revert", func(w http.ResponseWriter, r *http.Request) {
193-
testMethod(t, r, "POST")
193+
testMethod(t, r, http.MethodPost)
194194
testBody(t, r, `{"branch":"release"}`)
195195
mustWriteHTTPResponse(t, w, "testdata/get_commit.json")
196196
})
@@ -236,7 +236,7 @@ func TestGetGPGSignature(t *testing.T) {
236236
defer teardown(server)
237237

238238
mux.HandleFunc("/api/v4/projects/1/repository/commits/b0b3a907f41409829b307a28b82fdbd552ee5a27/signature", func(w http.ResponseWriter, r *http.Request) {
239-
testMethod(t, r, "GET")
239+
testMethod(t, r, http.MethodGet)
240240
mustWriteHTTPResponse(t, w, "testdata/get_signature.json")
241241
})
242242

custom_attributes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
)
2223

2324
// CustomAttributesService handles communication with the group, project and

custom_attributes_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestListCustomUserAttributes(t *testing.T) {
2828
defer teardown(server)
2929

3030
mux.HandleFunc("/api/v4/users/2/custom_attributes", func(w http.ResponseWriter, r *http.Request) {
31-
testMethod(t, r, "GET")
31+
testMethod(t, r, http.MethodGet)
3232
fmt.Fprint(w, `[{"key":"testkey1", "value":"testvalue1"}, {"key":"testkey2", "value":"testvalue2"}]`)
3333
})
3434

@@ -49,7 +49,7 @@ func TestListCustomGroupAttributes(t *testing.T) {
4949
defer teardown(server)
5050

5151
mux.HandleFunc("/api/v4/groups/2/custom_attributes", func(w http.ResponseWriter, r *http.Request) {
52-
testMethod(t, r, "GET")
52+
testMethod(t, r, http.MethodGet)
5353
fmt.Fprint(w, `[{"key":"testkey1", "value":"testvalue1"}, {"key":"testkey2", "value":"testvalue2"}]`)
5454
})
5555

@@ -70,7 +70,7 @@ func TestListCustomProjectAttributes(t *testing.T) {
7070
defer teardown(server)
7171

7272
mux.HandleFunc("/api/v4/projects/2/custom_attributes", func(w http.ResponseWriter, r *http.Request) {
73-
testMethod(t, r, "GET")
73+
testMethod(t, r, http.MethodGet)
7474
fmt.Fprint(w, `[{"key":"testkey1", "value":"testvalue1"}, {"key":"testkey2", "value":"testvalue2"}]`)
7575
})
7676

@@ -91,7 +91,7 @@ func TestGetCustomUserAttribute(t *testing.T) {
9191
defer teardown(server)
9292

9393
mux.HandleFunc("/api/v4/users/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
94-
testMethod(t, r, "GET")
94+
testMethod(t, r, http.MethodGet)
9595
fmt.Fprint(w, `{"key":"testkey1", "value":"testvalue1"}`)
9696
})
9797

@@ -112,7 +112,7 @@ func TestGetCustomGropupAttribute(t *testing.T) {
112112
defer teardown(server)
113113

114114
mux.HandleFunc("/api/v4/groups/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
115-
testMethod(t, r, "GET")
115+
testMethod(t, r, http.MethodGet)
116116
fmt.Fprint(w, `{"key":"testkey1", "value":"testvalue1"}`)
117117
})
118118

@@ -133,7 +133,7 @@ func TestGetCustomProjectAttribute(t *testing.T) {
133133
defer teardown(server)
134134

135135
mux.HandleFunc("/api/v4/projects/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
136-
testMethod(t, r, "GET")
136+
testMethod(t, r, http.MethodGet)
137137
fmt.Fprint(w, `{"key":"testkey1", "value":"testvalue1"}`)
138138
})
139139

@@ -154,7 +154,7 @@ func TestSetCustomUserAttribute(t *testing.T) {
154154
defer teardown(server)
155155

156156
mux.HandleFunc("/api/v4/users/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
157-
testMethod(t, r, "PUT")
157+
testMethod(t, r, http.MethodPut)
158158
fmt.Fprint(w, `{"key":"testkey1", "value":"testvalue1"}`)
159159
})
160160

@@ -178,7 +178,7 @@ func TestSetCustomGroupAttribute(t *testing.T) {
178178
defer teardown(server)
179179

180180
mux.HandleFunc("/api/v4/groups/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
181-
testMethod(t, r, "PUT")
181+
testMethod(t, r, http.MethodPut)
182182
fmt.Fprint(w, `{"key":"testkey1", "value":"testvalue1"}`)
183183
})
184184

@@ -202,7 +202,7 @@ func TestDeleteCustomUserAttribute(t *testing.T) {
202202
defer teardown(server)
203203

204204
mux.HandleFunc("/api/v4/users/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
205-
testMethod(t, r, "DELETE")
205+
testMethod(t, r, http.MethodDelete)
206206
w.WriteHeader(http.StatusAccepted)
207207
})
208208

@@ -223,7 +223,7 @@ func TestDeleteCustomGroupAttribute(t *testing.T) {
223223
defer teardown(server)
224224

225225
mux.HandleFunc("/api/v4/groups/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
226-
testMethod(t, r, "DELETE")
226+
testMethod(t, r, http.MethodDelete)
227227
w.WriteHeader(http.StatusAccepted)
228228
})
229229

@@ -244,7 +244,7 @@ func TestDeleteCustomProjectAttribute(t *testing.T) {
244244
defer teardown(server)
245245

246246
mux.HandleFunc("/api/v4/projects/2/custom_attributes/testkey1", func(w http.ResponseWriter, r *http.Request) {
247-
testMethod(t, r, "DELETE")
247+
testMethod(t, r, http.MethodDelete)
248248
w.WriteHeader(http.StatusAccepted)
249249
})
250250

deploy_tokens.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package gitlab
1818

1919
import (
2020
"fmt"
21+
"net/http"
2122
"time"
2223
)
2324

0 commit comments

Comments
 (0)