MCPcopy
hub / github.com/rclone/rclone / TestBase64

Function TestBase64

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

Source from the content-addressed store, hash-verified

469}
470
471func TestBase64(t *testing.T) {
472 ctx := context.Background()
473 r := fstest.NewRun(t)
474 err := transform.SetOptions(ctx, "all,base64encode")
475 require.NoError(t, err)
476 file1 := r.WriteFile("toe/toe/toe.txt", "hello world", t1)
477
478 r.Mkdir(ctx, r.Fremote)
479 ctx = predictDstFromLogger(ctx)
480 err = Sync(ctx, r.Fremote, r.Flocal, true)
481 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
482 require.NoError(t, err)
483
484 r.CheckLocalItems(t, file1)
485 r.CheckRemoteItems(t, fstest.NewItem("dG9l/dG9l/dG9lLnR4dA==", "hello world", t1))
486
487 // round trip
488 err = transform.SetOptions(ctx, "all,base64decode")
489 require.NoError(t, err)
490 ctx = predictDstFromLogger(ctx)
491 err = Sync(ctx, r.Flocal, r.Fremote, true)
492 testLoggerVsLsf(ctx, r.Flocal, r.Fremote, operations.GetLoggerOpt(ctx).JSON, t)
493 require.NoError(t, err)
494
495 r.CheckLocalItems(t, file1)
496 r.CheckRemoteItems(t, fstest.NewItem("dG9l/dG9l/dG9lLnR4dA==", "hello world", t1))
497}
498
499func TestError(t *testing.T) {
500 ctx := context.Background()

Callers

nothing calls this directly

Calls 11

WriteFileMethod · 0.95
MkdirMethod · 0.95
CheckLocalItemsMethod · 0.95
CheckRemoteItemsMethod · 0.95
NewRunFunction · 0.92
SetOptionsFunction · 0.92
GetLoggerOptFunction · 0.92
NewItemFunction · 0.92
predictDstFromLoggerFunction · 0.85
SyncFunction · 0.85
testLoggerVsLsfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…