| 1 | package lockingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/" |
| 7 | "net/http/httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/" |
| 8 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 9 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 11 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 12 | |
| 13 | "github.com/git-lfs/git-lfs/v3/gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/" |
| 14 | "github.com/git-lfs/git-lfs/v3/lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/" |
| 15 | "github.com/git-lfs/git-lfs/v3/lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/" |
| 16 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 17 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 18 | "github.com/xeipuuv/gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/" |
| 19 | ) |
| 20 | |
| 21 | func TestAPILockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/TestAPILock().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 22 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, createReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createReqSchema.) |
| 23 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema.) |
| 24 | |
| 25 | srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 26 | if r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. != "/api/locks" { |
| 27 | w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404) |
| 28 | return |
| 29 | } |
| 30 | |
| 31 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.) |
| 32 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Accept")) |
| 33 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.RequestContentTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/RequestContentType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Type")) |
| 34 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "53", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Length")) |
| 35 | |
| 36 | reqLoader, body := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewReaderLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewReaderLoader().(r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.) |
| 37 | lockReq := &lockRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#{} |
| 38 | err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewDecoder().(body).Decodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Decoder#Decode().(lockReq) |
| 39 | r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().() |
| 40 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 41 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "refs/heads/master", lockReq.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Ref..Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRef#Name.) |
| 42 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "request", lockReq.Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Path.) |
| 43 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, createReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createReqSchema., reqLoader) |
| 44 | |
| 45 | w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Content-Type", "application/json") |
| 46 | resLoader, resWriter := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewWriterLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewWriterLoader().(w) |
| 47 | err = jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewEncoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewEncoder().(resWriter).Encodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Encoder#Encode().(&lockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#{ |
| 48 | Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#Lock.: &Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{ |
| 49 | Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "1", |
| 50 | Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path.: "response", |
| 51 | }, |
| 52 | }) |
| 53 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 54 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema., resLoader) |
| 55 | })) |
| 56 | defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().() |
| 57 | |
| 58 | c := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewClient().(lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 59 | "lfs.url": srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. + "/api", |
| 60 | })) |
| 61 | |
| 62 | lc := &httpLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Client.: c} |
| 63 | lockRes, status, err := lc.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Lock().("", &lockRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#{Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Path.: "request", Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRequest#Ref.: &lockRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRef#{Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockRef#Name.: "refs/heads/master"}}) |
| 64 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err) |
| 65 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, status) |
| 66 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", lockRes.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#Lock..Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 67 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "response", lockRes.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockResponse#Lock..Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path.) |
| 68 | } |
| 69 | |
| 70 | func TestAPIUnlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/TestAPIUnlock().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 71 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, delReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/delReqSchema.) |
| 72 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema.) |
| 73 | |
| 74 | srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 75 | if r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. != "/api/locks/123/unlock" { |
| 76 | w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404) |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.) |
| 81 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Accept")) |
| 82 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.RequestContentTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/RequestContentType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Type")) |
| 83 | |
| 84 | reqLoader, body := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewReaderLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewReaderLoader().(r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.) |
| 85 | unlockReq := &unlockRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockRequest#{} |
| 86 | err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewDecoder().(body).Decodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Decoder#Decode().(unlockReq) |
| 87 | r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body..Closescip-go gomod github.com/golang/go/src go1.25.0 io/Closer#Close().() |
| 88 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 89 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/True().(t, unlockReq.Forcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockRequest#Force.) |
| 90 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, delReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/delReqSchema., reqLoader) |
| 91 | |
| 92 | w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Content-Type", "application/json") |
| 93 | resLoader, resWriter := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewWriterLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewWriterLoader().(w) |
| 94 | err = jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewEncoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewEncoder().(resWriter).Encodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Encoder#Encode().(&unlockResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#{ |
| 95 | Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#Lock.: &Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{ |
| 96 | Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "123", |
| 97 | Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path.: "response", |
| 98 | }, |
| 99 | }) |
| 100 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 101 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema., resLoader) |
| 102 | })) |
| 103 | defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().() |
| 104 | |
| 105 | c := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewClient().(lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 106 | "lfs.url": srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. + "/api", |
| 107 | })) |
| 108 | |
| 109 | lc := &httpLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Client.: c} |
| 110 | unlockRes, status, err := lc.Unlockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Unlock().(&gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.Refscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#{ |
| 111 | Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Name.: "master", |
| 112 | Shascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Sha.: "6161616161616161616161616161616161616161", |
| 113 | Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/Ref#Type.: gitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/.RefTypeLocalBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git`/RefTypeLocalBranch., |
| 114 | }, "", "123", true) |
| 115 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err) |
| 116 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, status) |
| 117 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "123", unlockRes.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#Lock..Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 118 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "response", unlockRes.Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/unlockResponse#Lock..Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Path.) |
| 119 | } |
| 120 | |
| 121 | func TestAPISearchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/TestAPISearch().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 122 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, listResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/listResSchema.) |
| 123 | |
| 124 | srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 125 | if r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. != "/api/locks" { |
| 126 | w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404) |
| 127 | return |
| 128 | } |
| 129 | |
| 130 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "GET", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.) |
| 131 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Accept")) |
| 132 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "", r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Type")) |
| 133 | |
| 134 | q := r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Queryscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Query().() |
| 135 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "A", q.Getscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Values#Get().("a")) |
| 136 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cursor", q.Getscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Values#Get().("cursor")) |
| 137 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "5", q.Getscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Values#Get().("limit")) |
| 138 | |
| 139 | w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Content-Type", "application/json") |
| 140 | resLoader, resWriter := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewWriterLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewWriterLoader().(w) |
| 141 | err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewEncoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewEncoder().(resWriter).Encodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Encoder#Encode().(&lockListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#{ |
| 142 | Locksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Locks.: []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{ |
| 143 | {Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "1"}, |
| 144 | {Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "2"}, |
| 145 | }, |
| 146 | }) |
| 147 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 148 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, listResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/listResSchema., resLoader) |
| 149 | })) |
| 150 | defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().() |
| 151 | |
| 152 | c := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewClient().(lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 153 | "lfs.url": srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. + "/api", |
| 154 | })) |
| 155 | |
| 156 | lc := &httpLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Client.: c} |
| 157 | locks, status, err := lc.Searchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Search().("", &lockSearchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#{ |
| 158 | Filtersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#Filters.: []lockFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockFilter#{ |
| 159 | {Propertyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockFilter#Property.: "a", Valuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockFilter#Value.: "A"}, |
| 160 | }, |
| 161 | Cursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#Cursor.: "cursor", |
| 162 | Limitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockSearchRequest#Limit.: 5, |
| 163 | }) |
| 164 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err) |
| 165 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, status) |
| 166 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(locks.Locksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Locks.)) |
| 167 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", locks.Locksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Locks.[0].Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 168 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "2", locks.Locksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockList#Locks.[1].Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 169 | } |
| 170 | |
| 171 | func TestAPISearchVerifiablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/TestAPISearchVerifiable().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 172 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, verifyResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/verifyResSchema.) |
| 173 | |
| 174 | srv := httptestscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/.NewServerscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/NewServer().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 175 | if r.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#URL..Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path. != "/api/locks/verify" { |
| 176 | w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404) |
| 177 | return |
| 178 | } |
| 179 | |
| 180 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "POST", r.Methodscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Method.) |
| 181 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.MediaTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/MediaType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Accept")) |
| 182 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.RequestContentTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/RequestContentType., r.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Header..Getscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Get().("Content-Type")) |
| 183 | |
| 184 | body := lockVerifiableRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#{} |
| 185 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewDecoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewDecoder().(r.Bodyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#Body.).Decodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Decoder#Decode().(&body)) { |
| 186 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "cursor", body.Cursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Cursor.) |
| 187 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 5, body.Limitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Limit.) |
| 188 | } |
| 189 | |
| 190 | w.Headerscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Header().().Setscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Header#Set().("Content-Type", "application/json") |
| 191 | resLoader, resWriter := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewWriterLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewWriterLoader().(w) |
| 192 | err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.NewEncoderscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/NewEncoder().(resWriter).Encodescip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Encoder#Encode().(&lockVerifiableListscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#{ |
| 193 | Oursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Ours.: []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{ |
| 194 | {Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "1"}, |
| 195 | {Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "2"}, |
| 196 | }, |
| 197 | Theirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Theirs.: []Lockscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#{ |
| 198 | {Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.: "3"}, |
| 199 | }, |
| 200 | }) |
| 201 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 202 | assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t, verifyResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/verifyResSchema., resLoader) |
| 203 | })) |
| 204 | defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().() |
| 205 | |
| 206 | c := lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/.NewClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/NewClient().(lfshttpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/.NewContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfshttp`/NewContext().(nil, nil, map[string]string{ |
| 207 | "lfs.url": srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. + "/api", |
| 208 | })) |
| 209 | |
| 210 | lc := &httpLockClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#Client.: c} |
| 211 | locks, status, err := lc.SearchVerifiablescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/httpLockClient#SearchVerifiable().("", &lockVerifiableRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#{ |
| 212 | Cursorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Cursor.: "cursor", |
| 213 | Limitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableRequest#Limit.: 5, |
| 214 | }) |
| 215 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Nil().(t, err) |
| 216 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 200, status) |
| 217 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 2, len(locks.Oursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Ours.)) |
| 218 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "1", locks.Oursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Ours.[0].Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 219 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "2", locks.Oursscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Ours.[1].Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 220 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, 1, len(locks.Theirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Theirs.)) |
| 221 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, "3", locks.Theirsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/lockVerifiableList#Theirs.[0].Idscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/Lock#Id.) |
| 222 | } |
| 223 | |
| 224 | var ( |
| 225 | createReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createReqSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# |
| 226 | createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# |
| 227 | delReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/delReqSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# |
| 228 | listResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/listResSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# |
| 229 | verifyResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/verifyResSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# |
| 230 | ) |
| 231 | |
| 232 | func initscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/init().() { |
| 233 | wd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Getwdscip-go gomod github.com/golang/go/src go1.25.0 os/Getwd().() |
| 234 | if err != nil { |
| 235 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Println().("getwd error:", err) |
| 236 | return |
| 237 | } |
| 238 | |
| 239 | createReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createReqSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, "schemas/http-lock-create-request-schema.json") |
| 240 | createResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/createResSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, "schemas/http-lock-create-response-schema.json") |
| 241 | delReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/delReqSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, "schemas/http-lock-delete-request-schema.json") |
| 242 | listResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/listResSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, "schemas/http-lock-list-response-schema.json") |
| 243 | verifyResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/verifyResSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, "schemas/http-lock-verify-response-schema.json") |
| 244 | } |
| 245 | |
| 246 | type sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# struct { |
| 247 | Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#Source. string |
| 248 | *gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.Schemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#Schema. |
| 249 | } |
| 250 | |
| 251 | func getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/getSchema().(wd, relpath string) *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema# { |
| 252 | abspath := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/ToSlash().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(wd, relpath)) |
| 253 | s, err := gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewSchemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewSchema().(gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.NewReferenceLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/NewReferenceLoader().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("file:///%s", abspath))) |
| 254 | if err != nil { |
| 255 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("schema load error for %q: %+v\n", relpath, err) |
| 256 | } |
| 257 | return &sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#{Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#Source.: relpath, Schemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#Schema.: s} |
| 258 | } |
| 259 | |
| 260 | func assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/assertSchema().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, schema *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#, dataLoader gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/.JSONLoaderscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/JSONLoader#) { |
| 261 | res, err := schema.Validatescip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Schema#Validate().(dataLoader) |
| 262 | if assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, err) { |
| 263 | if res.Validscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Result#Valid().() { |
| 264 | return |
| 265 | } |
| 266 | |
| 267 | resErrors := res.Errorsscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Result#Errors().() |
| 268 | valErrors := make([]string, 0, len(resErrors)) |
| 269 | for _, resErr := range resErrors { |
| 270 | valErrors = append(valErrors, resErr.Stringscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/ResultError#String().()) |
| 271 | } |
| 272 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Schema: %s\n%s", schema.Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/locking`/sourcedSchema#Source., stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(valErrors, "\n")) |
| 273 | } |
| 274 | } |