(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func TestPutStdin_UploadsToDashPath(t *testing.T) { |
| 187 | content := "dash path" |
| 188 | cmd := testPutCmdWithStdin(strings.NewReader(content)) |
| 189 | |
| 190 | var uploadedPath string |
| 191 | mock := &mockFilesClient{ |
| 192 | getMetadataFn: func(arg *files.GetMetadataArg) (files.IsMetadata, error) { |
| 193 | return nil, &files.GetMetadataAPIError{} |
| 194 | }, |
| 195 | uploadFn: func(arg *files.UploadArg, r io.Reader) (*files.FileMetadata, error) { |
| 196 | uploadedPath = arg.Path |
| 197 | _, _ = io.ReadAll(r) |
| 198 | return &files.FileMetadata{}, nil |
| 199 | }, |
| 200 | } |
| 201 | stubFilesClient(t, mock) |
| 202 | |
| 203 | err := put(cmd, []string{"-", "/-"}) |
| 204 | if err != nil { |
| 205 | t.Fatalf("put stdin error: %v", err) |
| 206 | } |
| 207 | if uploadedPath != "/-" { |
| 208 | t.Errorf("uploaded path = %q, want /-", uploadedPath) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func TestPutStdin_EmptyUploadsZeroBytes(t *testing.T) { |
| 213 | cmd := testPutCmdWithStdin(strings.NewReader("")) |
nothing calls this directly
no test coverage detected