MCPcopy
hub / github.com/git-lfs/git-lfs / TestAdapterRegButBasicOnly

Function TestAdapterRegButBasicOnly

tq/transfer_test.go:144–174  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestAdapterRegButBasicOnly(t *testing.T) {
145 cli, err := lfsapi.NewClient(lfshttp.NewContext(nil, nil, map[string]string{
146 "lfs.basictransfersonly": "yes",
147 }))
148 require.Nil(t, err)
149
150 m := NewManifest(nil, cli, "", "")
151
152 assert := assert.New(t)
153
154 m.RegisterNewAdapterFunc("test", Upload, newTestAdapter)
155 m.RegisterNewAdapterFunc("test", Download, newTestAdapter)
156 // Will still be created if we ask for them
157 da := m.NewDownloadAdapter("test")
158 if assert.NotNil(da) {
159 assert.Equal("test", da.Name())
160 assert.Equal(Download, da.Direction())
161 }
162
163 ua := m.NewUploadAdapter("test")
164 if assert.NotNil(ua) {
165 assert.Equal("test", ua.Name())
166 assert.Equal(Upload, ua.Direction())
167 }
168
169 // But list will exclude
170 ld := m.GetDownloadAdapterNames()
171 assert.Equal([]string{"basic"}, ld)
172 lu := m.GetUploadAdapterNames()
173 assert.Equal([]string{"basic"}, lu)
174}

Callers

nothing calls this directly

Calls 11

NewDownloadAdapterMethod · 0.95
NewUploadAdapterMethod · 0.95
GetUploadAdapterNamesMethod · 0.95
NewClientFunction · 0.92
NewContextFunction · 0.92
NewManifestFunction · 0.85
NameMethod · 0.65
DirectionMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected