MCPcopy
hub / github.com/rclone/rclone / TestManualTransformFile

Function TestManualTransformFile

fs/sync/sync_transform_test.go:441–469  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

439}
440
441func TestManualTransformFile(t *testing.T) {
442 ctx := context.Background()
443 r := fstest.NewRun(t)
444
445 r.Flocal.Features().DisableList([]string{"Copy", "Move"})
446 r.Fremote.Features().DisableList([]string{"Copy", "Move"})
447
448 err := transform.SetOptions(ctx, "all,prefix=tac", "all,prefix=tic")
449 require.NoError(t, err)
450 r.WriteFile("toe/toe/toe.txt", "hello world", t1)
451 _, err = operations.MkdirModTime(ctx, r.Flocal, "empty_dir", t1)
452 require.NoError(t, err)
453
454 r.Mkdir(ctx, r.Fremote)
455 ctx = predictDstFromLogger(ctx)
456 err = MoveDir(ctx, r.Fremote, r.Flocal, true, true)
457 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
458 require.NoError(t, err)
459
460 r.CheckLocalListing(t, []fstest.Item{}, []string{})
461 r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("tictactoe/tictactoe/tictactoe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe"})
462
463 err = transform.SetOptions(ctx, "all,trimprefix=tic", "all,trimprefix=tac")
464 require.NoError(t, err)
465 err = operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
466 require.NoError(t, err)
467 r.CheckLocalListing(t, []fstest.Item{}, []string{})
468 r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("toe/toe/toe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe", "toe", "toe/toe"})
469}
470
471func TestBase64(t *testing.T) {
472 ctx := context.Background()

Callers

nothing calls this directly

Calls 15

WriteFileMethod · 0.95
MkdirMethod · 0.95
CheckLocalListingMethod · 0.95
CheckRemoteListingMethod · 0.95
NewRunFunction · 0.92
SetOptionsFunction · 0.92
MkdirModTimeFunction · 0.92
GetLoggerOptFunction · 0.92
NewItemFunction · 0.92
TransformFileFunction · 0.92
predictDstFromLoggerFunction · 0.85
MoveDirFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…