diff --git a/services/storage-users/pkg/command/trash_bin.go b/services/storage-users/pkg/command/trash_bin.go index dc356c48b2..c43119477a 100644 --- a/services/storage-users/pkg/command/trash_bin.go +++ b/services/storage-users/pkg/command/trash_bin.go @@ -85,7 +85,7 @@ func PurgeExpiredResources(cfg *config.Config) *cobra.Command { func listTrashBinItems(cfg *config.Config) *cobra.Command { listTrashBinItemsCmd := &cobra.Command{ - Use: "list", + Use: "list space", Short: "Print a list of all trash-bin items of a space.", // TODO: n might need to equal 2 not sure. Args: cobra.ExactArgs(1), @@ -143,7 +143,7 @@ func listTrashBinItems(cfg *config.Config) *cobra.Command { func restoreAllTrashBinItems(cfg *config.Config) *cobra.Command { var overwriteOption int restoreAllTrashBinItemsCmd := &cobra.Command{ - Use: "restore-all", + Use: "restore-all space", Short: "Restore all trash-bin items for a space.", // TODO: not sure this could also be 2 Args: cobra.ExactArgs(1), @@ -253,7 +253,7 @@ func restoreAllTrashBinItems(cfg *config.Config) *cobra.Command { func restoreTrashBinItem(cfg *config.Config) *cobra.Command { var overwriteOption int restoreTrashBinItemCmd := &cobra.Command{ - Use: "restore", + Use: "restore space item", Short: "Restore a trash-bin item by ID.", Args: cobra.ExactArgs(2), PreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/services/storage-users/pkg/command/trash_bin_test.go b/services/storage-users/pkg/command/trash_bin_test.go index 26cfd4bc15..aeae663f32 100644 --- a/services/storage-users/pkg/command/trash_bin_test.go +++ b/services/storage-users/pkg/command/trash_bin_test.go @@ -2,8 +2,32 @@ package command import ( "testing" + + "github.com/opencloud-eu/opencloud/services/storage-users/pkg/config" + + "github.com/spf13/cobra" ) +func Test_trashBinCommandUse(t *testing.T) { + cfg := &config.Config{} + tests := []struct { + name string + cmd *cobra.Command + want string + }{ + {"list", listTrashBinItems(cfg), "list space"}, + {"restore-all", restoreAllTrashBinItems(cfg), "restore-all space"}, + {"restore", restoreTrashBinItem(cfg), "restore space item"}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.cmd.Use; got != tt.want { + t.Errorf("Use = %q, want %q", got, tt.want) + } + }) + } +} + func Test_modifyFilename(t *testing.T) { type args struct { filename string