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

Function TestCustomTransferUploadConfig

tq/custom_test.go:63–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestCustomTransferUploadConfig(t *testing.T) {
64 path := "/path/to/binary"
65 args := "-c 1 --whatever"
66 cli, err := lfsapi.NewClient(lfshttp.NewContext(nil, nil, map[string]string{
67 "lfs.customtransfer.testupload.path": path,
68 "lfs.customtransfer.testupload.args": args,
69 "lfs.customtransfer.testupload.concurrent": "false",
70 "lfs.customtransfer.testupload.direction": "upload",
71 }))
72 require.Nil(t, err)
73
74 m := NewManifest(nil, cli, "", "")
75 d := m.NewDownloadAdapter("testupload")
76 assert.NotNil(t, d, "Download adapter should always be created")
77 cd, _ := d.(*customAdapter)
78 assert.Nil(t, cd, "Download adapter should NOT be custom (default to basic)")
79
80 u := m.NewUploadAdapter("testupload")
81 assert.NotNil(t, u, "Upload adapter should be present")
82 cu, _ := u.(*customAdapter)
83 assert.NotNil(t, cu, "Upload adapter should be customAdapter")
84 assert.Equal(t, cu.path, path, "Path should be correct")
85 assert.Equal(t, cu.args, args, "args should be correct")
86 assert.Equal(t, cu.concurrent, false, "concurrent should be set")
87}
88
89func TestCustomTransferBothConfig(t *testing.T) {
90 path := "/path/to/binary"

Callers

nothing calls this directly

Calls 6

NewDownloadAdapterMethod · 0.95
NewUploadAdapterMethod · 0.95
NewClientFunction · 0.92
NewContextFunction · 0.92
NewManifestFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected