MCPcopy
hub / github.com/rclone/rclone / TestMoveFile

Function TestMoveFile

fs/operations/operations_test.go:952–979  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

950}
951
952func TestMoveFile(t *testing.T) {
953 ctx := context.Background()
954 r := fstest.NewRun(t)
955
956 file1 := r.WriteFile("file1", "file1 contents", t1)
957 r.CheckLocalItems(t, file1)
958
959 file2 := file1
960 file2.Path = "sub/file2"
961
962 err := operations.MoveFile(ctx, r.Fremote, r.Flocal, file2.Path, file1.Path)
963 require.NoError(t, err)
964 r.CheckLocalItems(t)
965 r.CheckRemoteItems(t, file2)
966
967 r.WriteFile("file1", "file1 contents", t1)
968 r.CheckLocalItems(t, file1)
969
970 err = operations.MoveFile(ctx, r.Fremote, r.Flocal, file2.Path, file1.Path)
971 require.NoError(t, err)
972 r.CheckLocalItems(t)
973 r.CheckRemoteItems(t, file2)
974
975 err = operations.MoveFile(ctx, r.Fremote, r.Fremote, file2.Path, file2.Path)
976 require.NoError(t, err)
977 r.CheckLocalItems(t)
978 r.CheckRemoteItems(t, file2)
979}
980
981func TestMoveFileWithIgnoreExisting(t *testing.T) {
982 ctx := context.Background()

Callers

nothing calls this directly

Calls 5

WriteFileMethod · 0.95
CheckLocalItemsMethod · 0.95
CheckRemoteItemsMethod · 0.95
NewRunFunction · 0.92
MoveFileFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…