MCPcopy Create free account
hub / github.com/52funny/pikpakcli / TestExpandShellGlobsDownload

Function TestExpandShellGlobsDownload

internal/shell/shell_test.go:474–496  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

472}
473
474func 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
498func TestExpandShellGlobsDelete(t *testing.T) {
499 rootCmd := &cobra.Command{Use: "pikpakcli"}

Callers

nothing calls this directly

Calls 2

adaptShellArgsFunction · 0.85
expandShellGlobsFunction · 0.85

Tested by

no test coverage detected