Debian Codegraph @

tq/api_test.go

raw symbols SCIP
1 package tqscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/
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/lfsapiscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfsapi`/"
14 "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`/"
15 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
16 "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/"
17 "github.com/xeipuuv/gojsonschemascip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/"
18 )
19
20 func TestAPIBatchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TestAPIBatch().(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#) {
21 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, batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema., batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema..Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source.)
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, batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema., batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema..Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source.)
23
24 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#) {
25 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/objects/batch" {
26 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404)
27 return
28 }
29
30 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.)
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, "106", 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"))
32
33 bodyLoader, 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.)
34 bReq := &batchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#{}
35 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().(bReq)
36 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().()
37 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)
38 assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/assertSchema().(t, batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema., bodyLoader)
39
40 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.EqualValuesscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/EqualValues().(t, []string{"basic", "whatev"}, bReq.TransferAdapterNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#TransferAdapterNames.)
41 if 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(bReq.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.)) {
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, "a", bReq.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.[0].Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.)
43 }
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
47 writeLoader, 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)
48 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().(&BatchResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#{
49 TransferAdapterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#TransferAdapterName.: "basic",
50 Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects.: bReq.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.,
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/tq`/assertSchema().(t, batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema., writeLoader)
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 tqc := &tqClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Client.: c}
63 bReq := &batchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#{
64 TransferAdapterNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#TransferAdapterNames.: []string{"basic", "whatev"},
65 Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.: []*Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{
66 &Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.: "a", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Size.: 1},
67 },
68 }
69 bRes, err := tqc.Batchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Batch().("remote", bReq)
70 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)
71 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, "basic", bRes.TransferAdapterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#TransferAdapterName.)
72 if 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(bRes.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects.)) {
73 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", bRes.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects.[0].Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.)
74 }
75 }
76
77 func TestAPIBatchOnlyBasicscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TestAPIBatchOnlyBasic().(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#) {
78 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, batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema., batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema..Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source.)
79 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, batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema., batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema..Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source.)
80
81 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#) {
82 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/objects/batch" {
83 w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(404)
84 return
85 }
86
87 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.)
88
89 bodyLoader, 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.)
90 bReq := &batchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#{}
91 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().(bReq)
92 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().()
93 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)
94 assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/assertSchema().(t, batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema., bodyLoader)
95
96 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, 0, len(bReq.TransferAdapterNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#TransferAdapterNames.))
97 if 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(bReq.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.)) {
98 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", bReq.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.[0].Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.)
99 }
100
101 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")
102 writeLoader, 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)
103 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().(&BatchResponsescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#{
104 TransferAdapterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#TransferAdapterName.: "basic",
105 Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects.: make([]*Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#, 0),
106 })
107
108 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)
109 assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/assertSchema().(t, batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema., writeLoader)
110 }))
111 defer srv.Closescip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#Close().()
112
113 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{
114 "lfs.url": srv.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/http/httptest`/Server#URL. + "/api",
115 }))
116
117 tqc := &tqClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Client.: c}
118 bReq := &batchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#{
119 TransferAdapterNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#TransferAdapterNames.: []string{"basic"},
120 Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#Objects.: []*Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{
121 &Transferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#{Oidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Oid.: "a", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/Transfer#Size.: 1},
122 },
123 }
124 bRes, err := tqc.Batchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Batch().("remote", bReq)
125 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)
126 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, "basic", bRes.TransferAdapterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#TransferAdapterName.)
127 }
128
129 func TestAPIBatchEmptyObjectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/TestAPIBatchEmptyObjects().(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#) {
130 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().(nil)
131
132 tqc := &tqClientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#{Clientscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Client.: c}
133 bReq := &batchRequestscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#{
134 TransferAdapterNamesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchRequest#TransferAdapterNames.: []string{"basic", "whatev"},
135 }
136 bRes, err := tqc.Batchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/tqClient#Batch().("remote", bReq)
137 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)
138 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, "", bRes.TransferAdapterNamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#TransferAdapterName.)
139 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, 0, len(bRes.Objectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/BatchResponse#Objects.))
140 }
141
142 var (
143 batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#
144 batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema. *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#
145 )
146
147 func initscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/init().() {
148 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().()
149 if err != nil {
150 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)
151 return
152 }
153
154 batchReqSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchReqSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/getSchema().(wd, "schemas/http-batch-request-schema.json")
155 batchResSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/batchResSchema. = getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/getSchema().(wd, "schemas/http-batch-response-schema.json")
156 }
157
158 type sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema# struct {
159 Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source. string
160 *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/tq`/sourcedSchema#Schema.
161 }
162
163 func getSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/getSchema().(wd, relpath string) *sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema# {
164 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))
165 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)))
166 if err != nil {
167 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)
168 }
169 return &sourcedSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#{Sourcescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Source.: relpath, Schemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/sourcedSchema#Schema.: s}
170 }
171
172 func assertSchemascip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tq`/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/tq`/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#) {
173 res, err := schema.Validatescip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Schema#Validate().(dataLoader)
174 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) {
175 if res.Validscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Result#Valid().() {
176 return
177 }
178
179 resErrors := res.Errorsscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/Result#Errors().()
180 valErrors := make([]string, 0, len(resErrors))
181 for _, resErr := range resErrors {
182 valErrors = append(valErrors, resErr.Stringscip-go gomod github.com/xeipuuv/gojsonschema v1.2.0 `github.com/xeipuuv/gojsonschema`/ResultError#String().())
183 }
184 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/tq`/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"))
185 }
186 }