MCPcopy
hub / github.com/rclone/rclone / TestTransformFile

Function TestTransformFile

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

Source from the content-addressed store, hash-verified

413}
414
415func TestTransformFile(t *testing.T) {
416 ctx := context.Background()
417 r := fstest.NewRun(t)
418 err := transform.SetOptions(ctx, "all,prefix=tac", "all,prefix=tic")
419 require.NoError(t, err)
420 r.WriteFile("toe/toe/toe.txt", "hello world", t1)
421 _, err = operations.MkdirModTime(ctx, r.Flocal, "empty_dir", t1)
422 require.NoError(t, err)
423
424 r.Mkdir(ctx, r.Fremote)
425 ctx = predictDstFromLogger(ctx)
426 err = MoveDir(ctx, r.Fremote, r.Flocal, true, true)
427 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
428 require.NoError(t, err)
429
430 r.CheckLocalListing(t, []fstest.Item{}, []string{})
431 r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("tictactoe/tictactoe/tictactoe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe"})
432
433 err = transform.SetOptions(ctx, "all,trimprefix=tic", "all,trimprefix=tac")
434 require.NoError(t, err)
435 err = operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
436 require.NoError(t, err)
437 r.CheckLocalListing(t, []fstest.Item{}, []string{})
438 r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("toe/toe/toe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe", "toe", "toe/toe"})
439}
440
441func TestManualTransformFile(t *testing.T) {
442 ctx := context.Background()

Callers

nothing calls this directly

Calls 13

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…