(t *testing.T)
| 472 | } |
| 473 | |
| 474 | func TestExpandShellGlobsDownload(t *testing.T) { |
| 475 | rootCmd := &cobra.Command{Use: "pikpakcli"} |
| 476 | downloadCmd := &cobra.Command{Use: "download"} |
| 477 | downloadCmd.Flags().StringP("path", "p", "/", "") |
| 478 | downloadCmd.Flags().StringP("parent-id", "P", "", "") |
| 479 | rootCmd.AddCommand(downloadCmd) |
| 480 | |
| 481 | args := adaptShellArgs(rootCmd, "/Movies", []string{"download", "*.mp4"}) |
| 482 | expanded, err := expandShellGlobs(rootCmd, "/Movies", fakeFileStatProvider{ |
| 483 | folders: map[string][]api.FileStat{ |
| 484 | "movies-id": { |
| 485 | {Name: "movie-1.mp4", Kind: api.FileKindFile}, |
| 486 | {Name: "movie-2.mp4", Kind: api.FileKindFile}, |
| 487 | {Name: "note.txt", Kind: api.FileKindFile}, |
| 488 | }, |
| 489 | }, |
| 490 | ids: map[string]string{ |
| 491 | "/Movies": "movies-id", |
| 492 | }, |
| 493 | }, args) |
| 494 | require.NoError(t, err) |
| 495 | require.Equal(t, []string{"download", "-p", "/Movies", "movie-1.mp4", "movie-2.mp4"}, expanded) |
| 496 | } |
| 497 | |
| 498 | func TestExpandShellGlobsDelete(t *testing.T) { |
| 499 | rootCmd := &cobra.Command{Use: "pikpakcli"} |
nothing calls this directly
no test coverage detected