MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestPutTextModeWritesNoStdoutOnSuccess

Function TestPutTextModeWritesNoStdoutOnSuccess

cmd/put_test.go:1094–1119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1092}
1093
1094func TestPutTextModeWritesNoStdoutOnSuccess(t *testing.T) {
1095 tmpFile := filepath.Join(t.TempDir(), "test.txt")
1096 if err := os.WriteFile(tmpFile, []byte("test"), 0644); err != nil {
1097 t.Fatal(err)
1098 }
1099
1100 mock := &mockFilesClient{
1101 uploadFn: func(arg *files.UploadArg, content io.Reader) (*files.FileMetadata, error) {
1102 if _, err := io.ReadAll(content); err != nil {
1103 t.Fatal(err)
1104 }
1105 return putFileMetadata(arg.Path, 4), nil
1106 },
1107 }
1108 stubFilesClient(t, mock)
1109
1110 var stdout bytes.Buffer
1111 cmd := testPutCmd()
1112 cmd.SetOut(&stdout)
1113 if err := put(cmd, []string{tmpFile, "/text.txt"}); err != nil {
1114 t.Fatalf("put error: %v", err)
1115 }
1116 if stdout.Len() != 0 {
1117 t.Fatalf("stdout = %q, want empty", stdout.String())
1118 }
1119}
1120
1121func TestDropboxClientModifiedUsesUTCSecondPrecision(t *testing.T) {
1122 input := time.Date(2026, 7, 1, 12, 34, 56, 600*1e6, time.FixedZone("source", -7*60*60))

Callers

nothing calls this directly

Calls 4

putFileMetadataFunction · 0.85
stubFilesClientFunction · 0.85
testPutCmdFunction · 0.85
putFunction · 0.85

Tested by

no test coverage detected