5
5
package integrations
6
6
7
7
import (
8
- "io/ioutil "
8
+ "fmt "
9
9
"net/http"
10
- "strings"
11
10
"testing"
12
11
"time"
13
12
@@ -102,10 +101,9 @@ func TestAPILFSLocksLogged(t *testing.T) {
102
101
//create locks
103
102
for _ , test := range tests {
104
103
session := loginUser (t , test .user .Name )
105
- req := NewRequestf (t , "POST" , "/%s/info/lfs/locks" , test .repo .FullName ())
104
+ req := NewRequestWithJSON (t , "POST" , fmt . Sprintf ( "/%s/info/lfs/locks" , test .repo .FullName ()), map [ string ] string { "path" : test . path } )
106
105
req .Header .Set ("Accept" , "application/vnd.git-lfs+json" )
107
106
req .Header .Set ("Content-Type" , "application/vnd.git-lfs+json" )
108
- req .Body = ioutil .NopCloser (strings .NewReader ("{\" path\" : \" " + test .path + "\" }" ))
109
107
session .MakeRequest (t , req , test .httpResult )
110
108
if len (test .addTime ) > 0 {
111
109
for _ , id := range test .addTime {
@@ -129,10 +127,9 @@ func TestAPILFSLocksLogged(t *testing.T) {
129
127
assert .WithinDuration (t , test .locksTimes [i ], lock .LockedAt , 1 * time .Second )
130
128
}
131
129
132
- req = NewRequestf (t , "POST" , "/%s/info/lfs/locks/verify" , test .repo .FullName ())
130
+ req = NewRequestWithJSON (t , "POST" , fmt . Sprintf ( "/%s/info/lfs/locks/verify" , test .repo .FullName ()), map [ string ] string {} )
133
131
req .Header .Set ("Accept" , "application/vnd.git-lfs+json" )
134
132
req .Header .Set ("Content-Type" , "application/vnd.git-lfs+json" )
135
- req .Body = ioutil .NopCloser (strings .NewReader ("{}" ))
136
133
resp = session .MakeRequest (t , req , http .StatusOK )
137
134
var lfsLocksVerify api.LFSLockListVerify
138
135
DecodeJSON (t , resp , & lfsLocksVerify )
@@ -154,10 +151,9 @@ func TestAPILFSLocksLogged(t *testing.T) {
154
151
//remove all locks
155
152
for _ , test := range deleteTests {
156
153
session := loginUser (t , test .user .Name )
157
- req := NewRequestf (t , "POST" , "/%s/info/lfs/locks/%s/unlock" , test .repo .FullName (), test .lockID )
154
+ req := NewRequestWithJSON (t , "POST" , fmt . Sprintf ( "/%s/info/lfs/locks/%s/unlock" , test .repo .FullName (), test .lockID ), map [ string ] string {} )
158
155
req .Header .Set ("Accept" , "application/vnd.git-lfs+json" )
159
156
req .Header .Set ("Content-Type" , "application/vnd.git-lfs+json" )
160
- req .Body = ioutil .NopCloser (strings .NewReader ("{}" ))
161
157
resp := session .MakeRequest (t , req , http .StatusOK )
162
158
var lfsLockRep api.LFSLockResponse
163
159
DecodeJSON (t , resp , & lfsLockRep )
0 commit comments