MCPcopy Create free account
hub / github.com/openclaw/gogcli / withDriveTestOperations

Function withDriveTestOperations

internal/cmd/drive_testutil_test.go:42–59  ·  view source on GitHub ↗
(
	ctx context.Context,
	svc *drive.Service,
	download app.DriveDownloadFunc,
	export app.DriveExportFunc,
)

Source from the content-addressed store, hash-verified

40}
41
42func withDriveTestOperations(
43 ctx context.Context,
44 svc *drive.Service,
45 download app.DriveDownloadFunc,
46 export app.DriveExportFunc,
47) context.Context {
48 if ctx == nil {
49 ctx = context.Background()
50 }
51 runtime := &app.Runtime{}
52 if existing, ok := app.FromContext(ctx); ok {
53 *runtime = *existing
54 }
55 runtime.Services.Drive = stubDriveService(svc)
56 runtime.Services.DriveDownload = download
57 runtime.Services.DriveExport = export
58 return app.WithRuntime(ctx, runtime)
59}
60
61func executeWithDriveTestService(t *testing.T, args []string, svc *drive.Service) executeTestResult {
62 t.Helper()

Calls 3

FromContextFunction · 0.92
WithRuntimeFunction · 0.92
stubDriveServiceFunction · 0.85

Tested by

no test coverage detected