Re add --restore-permissions flag (#2967)

This seems to have accidentally removed in 285f8f0

---

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

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

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 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. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-03-29 09:43:03 +05:30 committed by GitHub
parent 91e0a27831
commit dde61db779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 12 deletions

View File

@ -11,15 +11,15 @@ import (
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
) )
type ExchangeSuite struct { type ExchangeUnitSuite struct {
tester.Suite tester.Suite
} }
func TestExchangeSuite(t *testing.T) { func TestExchangeUnitSuite(t *testing.T) {
suite.Run(t, &ExchangeSuite{Suite: tester.NewUnitSuite(t)}) suite.Run(t, &ExchangeUnitSuite{Suite: tester.NewUnitSuite(t)})
} }
func (suite *ExchangeSuite) TestAddExchangeCommands() { func (suite *ExchangeUnitSuite) TestAddExchangeCommands() {
expectUse := exchangeServiceCommand + " " + exchangeServiceCommandUseSuffix expectUse := exchangeServiceCommand + " " + exchangeServiceCommandUseSuffix
table := []struct { table := []struct {

View File

@ -36,6 +36,9 @@ func addOneDriveCommands(cmd *cobra.Command) *cobra.Command {
utils.AddBackupIDFlag(c, true) utils.AddBackupIDFlag(c, true)
utils.AddOneDriveDetailsAndRestoreFlags(c) utils.AddOneDriveDetailsAndRestoreFlags(c)
// restore permissions
options.AddRestorePermissionsFlag(c)
// others // others
options.AddOperationFlags(c) options.AddOperationFlags(c)
} }

View File

@ -8,18 +8,19 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/cli/utils"
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
) )
type OneDriveSuite struct { type OneDriveUnitSuite struct {
tester.Suite tester.Suite
} }
func TestOneDriveSuite(t *testing.T) { func TestOneDriveUnitSuite(t *testing.T) {
suite.Run(t, &OneDriveSuite{Suite: tester.NewUnitSuite(t)}) suite.Run(t, &OneDriveUnitSuite{Suite: tester.NewUnitSuite(t)})
} }
func (suite *OneDriveSuite) TestAddOneDriveCommands() { func (suite *OneDriveUnitSuite) TestAddOneDriveCommands() {
expectUse := oneDriveServiceCommand + " " + oneDriveServiceCommandUseSuffix expectUse := oneDriveServiceCommand + " " + oneDriveServiceCommandUseSuffix
table := []struct { table := []struct {
@ -47,6 +48,9 @@ func (suite *OneDriveSuite) TestAddOneDriveCommands() {
assert.Equal(t, test.expectUse, child.Use) assert.Equal(t, test.expectUse, child.Use)
assert.Equal(t, test.expectShort, child.Short) assert.Equal(t, test.expectShort, child.Short)
tester.AreSameFunc(t, test.expectRunE, child.RunE) tester.AreSameFunc(t, test.expectRunE, child.RunE)
assert.NotNil(t, c.Flag(utils.BackupFN))
assert.NotNil(t, c.Flag("restore-permissions"))
}) })
} }
} }

View File

@ -11,15 +11,15 @@ import (
"github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester"
) )
type SharePointSuite struct { type SharePointUnitSuite struct {
tester.Suite tester.Suite
} }
func TestSharePointSuite(t *testing.T) { func TestSharePointUnitSuite(t *testing.T) {
suite.Run(t, &SharePointSuite{Suite: tester.NewUnitSuite(t)}) suite.Run(t, &SharePointUnitSuite{Suite: tester.NewUnitSuite(t)})
} }
func (suite *SharePointSuite) TestAddSharePointCommands() { func (suite *SharePointUnitSuite) TestAddSharePointCommands() {
expectUse := sharePointServiceCommand + " " + sharePointServiceCommandUseSuffix expectUse := sharePointServiceCommand + " " + sharePointServiceCommandUseSuffix
table := []struct { table := []struct {