corso/src/cli/cli_test.go
Abin Simon 921542c0f5
Fix repo connect error when we don't have a config (#2771)
Previously we were failing to connect to the repo if we did not have an existing config file present but could not run init to generate it (had already initialized the repo).

Error: retrieving storage provider details: bucket is required to perform this command

<!-- Insert PR description-->

---

#### Does this PR need a docs update or release note?

- [x]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ]  No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* Regression from https://github.com/alcionai/corso/pull/2534

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [x] 💚 E2E
2023-03-14 04:34:34 +00:00

34 lines
748 B
Go

package cli_test
import (
"testing"
"github.com/spf13/cobra"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/cli"
"github.com/alcionai/corso/src/internal/tester"
)
type CLIUnitSuite struct {
tester.Suite
}
func TestCLIUnitSuite(t *testing.T) {
suite.Run(t, &CLIUnitSuite{Suite: tester.NewUnitSuite(t)})
}
func (suite *CLIUnitSuite) TestAddCommands_noPanics() {
t := suite.T()
test := &cobra.Command{
Use: "test",
Short: "Free, Secure, Open-Source Backup for M365.",
Long: `Free, Secure, and Open-Source Backup for Microsoft 365.`,
RunE: func(c *cobra.Command, args []string) error { return nil },
}
assert.NotPanics(t, func() { cli.BuildCommandTree(test) })
}