## Description * Clean up pass on all CLI output * Added basic extended usage * Mark required params in generated docs ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [x] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * fixes #527 ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package repo
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/alcionai/corso/src/internal/tester"
|
|
)
|
|
|
|
type S3Suite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func TestS3Suite(t *testing.T) {
|
|
suite.Run(t, new(S3Suite))
|
|
}
|
|
|
|
func (suite *S3Suite) TestAddS3Commands() {
|
|
expectUse := s3ProviderCommand + s3ProviderCommandUseSuffix
|
|
|
|
table := []struct {
|
|
name string
|
|
use string
|
|
expectUse string
|
|
expectShort string
|
|
expectRunE func(*cobra.Command, []string) error
|
|
}{
|
|
{"init s3", initCommand, expectUse, s3InitCmd().Short, initS3Cmd},
|
|
{"connect s3", connectCommand, expectUse, s3ConnectCmd().Short, connectS3Cmd},
|
|
}
|
|
for _, test := range table {
|
|
suite.T().Run(test.name, func(t *testing.T) {
|
|
cmd := &cobra.Command{Use: test.use}
|
|
|
|
c := addS3Commands(cmd)
|
|
require.NotNil(t, c)
|
|
|
|
cmds := cmd.Commands()
|
|
require.Len(t, cmds, 1)
|
|
|
|
child := cmds[0]
|
|
assert.Equal(t, test.expectUse, child.Use)
|
|
assert.Equal(t, test.expectShort, child.Short)
|
|
tester.AreSameFunc(t, test.expectRunE, child.RunE)
|
|
})
|
|
}
|
|
}
|