@@ -11,6 +11,7 @@ import (
11
11
"time"
12
12
13
13
"code.gitea.io/gitea/models"
14
+ "code.gitea.io/gitea/modules/lfs"
14
15
"code.gitea.io/gitea/modules/setting"
15
16
api "code.gitea.io/gitea/modules/structs"
16
17
@@ -40,7 +41,7 @@ func TestAPILFSLocksNotLogin(t *testing.T) {
40
41
repo := models .AssertExistsAndLoadBean (t , & models.Repository {ID : 1 }).(* models.Repository )
41
42
42
43
req := NewRequestf (t , "GET" , "/%s/%s.git/info/lfs/locks" , user .Name , repo .Name )
43
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
44
+ req .Header .Set ("Accept" , lfs . MediaType )
44
45
resp := MakeRequest (t , req , http .StatusUnauthorized )
45
46
var lfsLockError api.LFSLockError
46
47
DecodeJSON (t , resp , & lfsLockError )
@@ -102,8 +103,8 @@ func TestAPILFSLocksLogged(t *testing.T) {
102
103
for _ , test := range tests {
103
104
session := loginUser (t , test .user .Name )
104
105
req := NewRequestWithJSON (t , "POST" , fmt .Sprintf ("/%s.git/info/lfs/locks" , test .repo .FullName ()), map [string ]string {"path" : test .path })
105
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
106
- req .Header .Set ("Content-Type" , "application/vnd.git- lfs+json" )
106
+ req .Header .Set ("Accept" , lfs . MediaType )
107
+ req .Header .Set ("Content-Type" , lfs . MediaType )
107
108
resp := session .MakeRequest (t , req , test .httpResult )
108
109
if len (test .addTime ) > 0 {
109
110
var lfsLock api.LFSLockResponse
@@ -119,7 +120,7 @@ func TestAPILFSLocksLogged(t *testing.T) {
119
120
for _ , test := range resultsTests {
120
121
session := loginUser (t , test .user .Name )
121
122
req := NewRequestf (t , "GET" , "/%s.git/info/lfs/locks" , test .repo .FullName ())
122
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
123
+ req .Header .Set ("Accept" , lfs . MediaType )
123
124
resp := session .MakeRequest (t , req , http .StatusOK )
124
125
var lfsLocks api.LFSLockList
125
126
DecodeJSON (t , resp , & lfsLocks )
@@ -131,8 +132,8 @@ func TestAPILFSLocksLogged(t *testing.T) {
131
132
}
132
133
133
134
req = NewRequestWithJSON (t , "POST" , fmt .Sprintf ("/%s.git/info/lfs/locks/verify" , test .repo .FullName ()), map [string ]string {})
134
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
135
- req .Header .Set ("Content-Type" , "application/vnd.git- lfs+json" )
135
+ req .Header .Set ("Accept" , lfs . MediaType )
136
+ req .Header .Set ("Content-Type" , lfs . MediaType )
136
137
resp = session .MakeRequest (t , req , http .StatusOK )
137
138
var lfsLocksVerify api.LFSLockListVerify
138
139
DecodeJSON (t , resp , & lfsLocksVerify )
@@ -155,8 +156,8 @@ func TestAPILFSLocksLogged(t *testing.T) {
155
156
for _ , test := range deleteTests {
156
157
session := loginUser (t , test .user .Name )
157
158
req := NewRequestWithJSON (t , "POST" , fmt .Sprintf ("/%s.git/info/lfs/locks/%s/unlock" , test .repo .FullName (), test .lockID ), map [string ]string {})
158
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
159
- req .Header .Set ("Content-Type" , "application/vnd.git- lfs+json" )
159
+ req .Header .Set ("Accept" , lfs . MediaType )
160
+ req .Header .Set ("Content-Type" , lfs . MediaType )
160
161
resp := session .MakeRequest (t , req , http .StatusOK )
161
162
var lfsLockRep api.LFSLockResponse
162
163
DecodeJSON (t , resp , & lfsLockRep )
@@ -168,7 +169,7 @@ func TestAPILFSLocksLogged(t *testing.T) {
168
169
for _ , test := range resultsTests {
169
170
session := loginUser (t , test .user .Name )
170
171
req := NewRequestf (t , "GET" , "/%s.git/info/lfs/locks" , test .repo .FullName ())
171
- req .Header .Set ("Accept" , "application/vnd.git- lfs+json" )
172
+ req .Header .Set ("Accept" , lfs . MediaType )
172
173
resp := session .MakeRequest (t , req , http .StatusOK )
173
174
var lfsLocks api.LFSLockList
174
175
DecodeJSON (t , resp , & lfsLocks )
0 commit comments