коммит произвёл
GitHub
родитель
f290745496
Коммит
c3ed07e679
@@ -20,7 +20,7 @@ func TestMessageExportNotEnabled(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
config.MessageExportSettings.EnableExport = model.NewBool(false)
|
||||
config.MessageExportSettings.EnableExport = model.NewPointer(false)
|
||||
th.SetConfig(config)
|
||||
|
||||
// should fail fast because the feature isn't enabled
|
||||
@@ -32,7 +32,7 @@ func TestMessageExportInvalidFormat(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
config.MessageExportSettings.EnableExport = model.NewBool(true)
|
||||
config.MessageExportSettings.EnableExport = model.NewPointer(true)
|
||||
th.SetConfig(config)
|
||||
|
||||
// should fail fast because format isn't supported
|
||||
@@ -44,7 +44,7 @@ func TestMessageExportNegativeExportFrom(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
config.MessageExportSettings.EnableExport = model.NewBool(true)
|
||||
config.MessageExportSettings.EnableExport = model.NewPointer(true)
|
||||
th.SetConfig(config)
|
||||
|
||||
// should fail fast because export from must be a valid timestamp
|
||||
@@ -56,7 +56,7 @@ func TestMessageExportNegativeTimeoutSeconds(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
config.MessageExportSettings.EnableExport = model.NewBool(true)
|
||||
config.MessageExportSettings.EnableExport = model.NewPointer(true)
|
||||
th.SetConfig(config)
|
||||
|
||||
// should fail fast because timeout seconds must be a positive int
|
||||
|
||||
@@ -896,8 +896,8 @@ func (s *MmctlUnitTestSuite) TestConfigMigrateCmd() {
|
||||
func TestCloudRestricted(t *testing.T) {
|
||||
cfg := &model.Config{
|
||||
ServiceSettings: model.ServiceSettings{
|
||||
GoogleDeveloperKey: model.NewString("test"),
|
||||
SiteURL: model.NewString("test"),
|
||||
GoogleDeveloperKey: model.NewPointer("test"),
|
||||
SiteURL: model.NewPointer("test"),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -937,40 +937,40 @@ func TestSetConfigValue(t *testing.T) {
|
||||
path: "LogSettings.EnableConsole",
|
||||
args: []string{"true"},
|
||||
config: &model.Config{LogSettings: model.LogSettings{
|
||||
EnableConsole: model.NewBool(false),
|
||||
EnableConsole: model.NewPointer(false),
|
||||
}},
|
||||
expectedConfig: &model.Config{LogSettings: model.LogSettings{
|
||||
EnableConsole: model.NewBool(true),
|
||||
EnableConsole: model.NewPointer(true),
|
||||
}},
|
||||
},
|
||||
"string": {
|
||||
path: "LogSettings.ConsoleLevel",
|
||||
args: []string{"foo"},
|
||||
config: &model.Config{LogSettings: model.LogSettings{
|
||||
ConsoleLevel: model.NewString("ConsoleLevel"),
|
||||
ConsoleLevel: model.NewPointer("ConsoleLevel"),
|
||||
}},
|
||||
expectedConfig: &model.Config{LogSettings: model.LogSettings{
|
||||
ConsoleLevel: model.NewString("foo"),
|
||||
ConsoleLevel: model.NewPointer("foo"),
|
||||
}},
|
||||
},
|
||||
"int": {
|
||||
path: "LogSettings.MaxFieldSize",
|
||||
args: []string{"123"},
|
||||
config: &model.Config{LogSettings: model.LogSettings{
|
||||
MaxFieldSize: model.NewInt(0),
|
||||
MaxFieldSize: model.NewPointer(0),
|
||||
}},
|
||||
expectedConfig: &model.Config{LogSettings: model.LogSettings{
|
||||
MaxFieldSize: model.NewInt(123),
|
||||
MaxFieldSize: model.NewPointer(123),
|
||||
}},
|
||||
},
|
||||
"int64": {
|
||||
path: "ServiceSettings.TLSStrictTransportMaxAge",
|
||||
config: &model.Config{ServiceSettings: model.ServiceSettings{
|
||||
TLSStrictTransportMaxAge: model.NewInt64(0),
|
||||
TLSStrictTransportMaxAge: model.NewPointer(int64(0)),
|
||||
}},
|
||||
args: []string{"123"},
|
||||
expectedConfig: &model.Config{ServiceSettings: model.ServiceSettings{
|
||||
TLSStrictTransportMaxAge: model.NewInt64(123),
|
||||
TLSStrictTransportMaxAge: model.NewPointer(int64(123)),
|
||||
}},
|
||||
},
|
||||
"string slice": {
|
||||
|
||||
@@ -184,7 +184,7 @@ func channelGroupEnableCmdF(c client.Client, cmd *cobra.Command, args []string)
|
||||
return errors.New("Channel '" + args[0] + "' has no groups associated. It cannot be group-constrained")
|
||||
}
|
||||
|
||||
channelPatch := model.ChannelPatch{GroupConstrained: model.NewBool(true)}
|
||||
channelPatch := model.ChannelPatch{GroupConstrained: model.NewPointer(true)}
|
||||
if _, _, err = c.PatchChannel(context.TODO(), channel.Id, &channelPatch); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -198,7 +198,7 @@ func channelGroupDisableCmdF(c client.Client, cmd *cobra.Command, args []string)
|
||||
return errors.New("Unable to find channel '" + args[0] + "'")
|
||||
}
|
||||
|
||||
channelPatch := model.ChannelPatch{GroupConstrained: model.NewBool(false)}
|
||||
channelPatch := model.ChannelPatch{GroupConstrained: model.NewPointer(false)}
|
||||
if _, _, err := c.PatchChannel(context.TODO(), channel.Id, &channelPatch); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -268,7 +268,7 @@ func teamGroupEnableCmdF(c client.Client, cmd *cobra.Command, args []string) err
|
||||
return errors.New("Team '" + args[0] + "' has no groups associated. It cannot be group-constrained")
|
||||
}
|
||||
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(true)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(true)}
|
||||
if _, _, err = c.PatchTeam(context.TODO(), team.Id, &teamPatch); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -282,7 +282,7 @@ func teamGroupDisableCmdF(c client.Client, cmd *cobra.Command, args []string) er
|
||||
return errors.New("Unable to find team '" + args[0] + "'")
|
||||
}
|
||||
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(false)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(false)}
|
||||
if _, _, err := c.PatchTeam(context.TODO(), team.Id, &teamPatch); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ func (s *MmctlE2ETestSuite) TestChannelGroupEnableCmd() {
|
||||
id := model.NewId()
|
||||
group, appErr := s.th.App.CreateGroup(&model.Group{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: model.NewString("name" + id),
|
||||
Name: model.NewPointer("name" + id),
|
||||
Source: model.GroupSourceLdap,
|
||||
Description: "description_" + id,
|
||||
RemoteId: model.NewString(model.NewId()),
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
@@ -68,7 +68,7 @@ func (s *MmctlE2ETestSuite) TestChannelGroupEnableCmd() {
|
||||
err := channelGroupEnableCmdF(c, &cobra.Command{}, []string{s.th.BasicTeam.Name + ":" + channelName})
|
||||
s.Require().NoError(err)
|
||||
|
||||
channel.GroupConstrained = model.NewBool(false)
|
||||
channel.GroupConstrained = model.NewPointer(false)
|
||||
defer func() {
|
||||
_, err := s.th.App.UpdateChannel(s.th.Context, channel)
|
||||
s.Require().Nil(err)
|
||||
@@ -102,10 +102,10 @@ func (s *MmctlE2ETestSuite) TestChannelGroupDisableCmd() {
|
||||
id := model.NewId()
|
||||
group, appErr := s.th.App.CreateGroup(&model.Group{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: model.NewString("name" + id),
|
||||
Name: model.NewPointer("name" + id),
|
||||
Source: model.GroupSourceLdap,
|
||||
Description: "description_" + id,
|
||||
RemoteId: model.NewString(model.NewId()),
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
@@ -124,7 +124,7 @@ func (s *MmctlE2ETestSuite) TestChannelGroupDisableCmd() {
|
||||
s.Require().Nil(err)
|
||||
}()
|
||||
|
||||
channel.GroupConstrained = model.NewBool(true)
|
||||
channel.GroupConstrained = model.NewPointer(true)
|
||||
defer func() {
|
||||
_, err := s.th.App.UpdateChannel(s.th.Context, channel)
|
||||
s.Require().Nil(err)
|
||||
@@ -145,7 +145,7 @@ func (s *MmctlE2ETestSuite) TestChannelGroupDisableCmd() {
|
||||
err := channelGroupDisableCmdF(c, &cobra.Command{}, []string{s.th.BasicTeam.Name + ":" + channelName})
|
||||
s.Require().NoError(err)
|
||||
|
||||
channel.GroupConstrained = model.NewBool(true)
|
||||
channel.GroupConstrained = model.NewPointer(true)
|
||||
defer func() {
|
||||
_, err := s.th.App.UpdateChannel(s.th.Context, channel)
|
||||
s.Require().Nil(err)
|
||||
@@ -194,7 +194,7 @@ func (s *MmctlE2ETestSuite) TestChannelGroupStatusCmd() {
|
||||
Name: channelName,
|
||||
DisplayName: "dn_" + channelName,
|
||||
Type: model.ChannelTypeOpen,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
GroupConstrained: model.NewPointer(true),
|
||||
}, false)
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
@@ -257,10 +257,10 @@ func (s *MmctlE2ETestSuite) TestChannelGroupListCmd() {
|
||||
id := model.NewId()
|
||||
group, appErr := s.th.App.CreateGroup(&model.Group{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: model.NewString("name" + id),
|
||||
Name: model.NewPointer("name" + id),
|
||||
Source: model.GroupSourceLdap,
|
||||
Description: "description_" + id,
|
||||
RemoteId: model.NewString(model.NewId()),
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
defer func() {
|
||||
@@ -308,7 +308,7 @@ func (s *MmctlE2ETestSuite) TestTeamGroupDisableCmd() {
|
||||
team, _, cleanUpFn := createTestGroupTeam(s)
|
||||
defer cleanUpFn()
|
||||
|
||||
team.GroupConstrained = model.NewBool(true)
|
||||
team.GroupConstrained = model.NewPointer(true)
|
||||
_, err := s.th.App.UpdateTeam(team)
|
||||
s.Require().Nil(err)
|
||||
|
||||
@@ -327,7 +327,7 @@ func (s *MmctlE2ETestSuite) TestTeamGroupDisableCmd() {
|
||||
err := teamGroupDisableCmdF(c, &cobra.Command{}, []string{team.Name})
|
||||
s.Require().NoError(err)
|
||||
|
||||
team.GroupConstrained = model.NewBool(true)
|
||||
team.GroupConstrained = model.NewPointer(true)
|
||||
defer func() {
|
||||
_, err := s.th.App.UpdateTeam(team)
|
||||
s.Require().Nil(err)
|
||||
@@ -363,7 +363,7 @@ func (s *MmctlE2ETestSuite) TestTeamGroupEnableCmd() {
|
||||
err := teamGroupEnableCmdF(c, &cobra.Command{}, []string{team.Name})
|
||||
s.Require().NoError(err)
|
||||
|
||||
team.GroupConstrained = model.NewBool(false)
|
||||
team.GroupConstrained = model.NewPointer(false)
|
||||
defer func() {
|
||||
_, err := s.th.App.UpdateTeam(team)
|
||||
s.Require().Nil(err)
|
||||
@@ -473,17 +473,17 @@ func createTestGroupTeam(s *MmctlE2ETestSuite) (*model.Team, *model.Group, func(
|
||||
Name: teamName,
|
||||
DisplayName: "dn_" + teamName,
|
||||
Type: model.TeamOpen,
|
||||
GroupConstrained: model.NewBool(true),
|
||||
GroupConstrained: model.NewPointer(true),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
id := model.NewId()
|
||||
group, appErr := s.th.App.CreateGroup(&model.Group{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: model.NewString("name" + id),
|
||||
Name: model.NewPointer("name" + id),
|
||||
Source: model.GroupSourceLdap,
|
||||
Description: "description_" + id,
|
||||
RemoteId: model.NewString(model.NewId()),
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
@@ -515,10 +515,10 @@ func (s *MmctlE2ETestSuite) TestUserGroupRestoreCmd() {
|
||||
id := model.NewId()
|
||||
group, appErr := s.th.App.CreateGroup(&model.Group{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: model.NewString("name" + id),
|
||||
Name: model.NewPointer("name" + id),
|
||||
Source: model.GroupSourceCustom,
|
||||
Description: "description_" + id,
|
||||
RemoteId: model.NewString(model.NewId()),
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
s.th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional, "ldap"))
|
||||
|
||||
@@ -154,7 +154,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
PerPage: 10,
|
||||
},
|
||||
}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(true)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(true)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -191,7 +191,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupEnableCmd() {
|
||||
PerPage: 10,
|
||||
},
|
||||
}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(true)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(true)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -223,7 +223,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupDisableCmd() {
|
||||
printer.Clean()
|
||||
teamArg := "example-team-id"
|
||||
mockTeam := model.Team{Id: teamArg}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(false)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(false)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -269,7 +269,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupDisableCmd() {
|
||||
printer.Clean()
|
||||
teamArg := "example-team-id"
|
||||
mockTeam := model.Team{Id: teamArg}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewBool(false)}
|
||||
teamPatch := model.TeamPatch{GroupConstrained: model.NewPointer(false)}
|
||||
mockError := errors.New("patchteam error")
|
||||
|
||||
s.client.
|
||||
@@ -302,7 +302,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
|
||||
mockTeam := model.Team{Id: teamID}
|
||||
mockChannel := model.Channel{Id: channelID}
|
||||
mockGroup := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewString(groupName)}}
|
||||
mockGroup := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewPointer(groupName)}}
|
||||
mockGroups := []*model.GroupWithSchemeAdmin{mockGroup}
|
||||
|
||||
groupOpts := &model.GroupSearchOpts{
|
||||
@@ -348,8 +348,8 @@ func (s *MmctlUnitTestSuite) TestChannelGroupListCmd() {
|
||||
mockTeam := model.Team{Id: teamID}
|
||||
mockChannel := model.Channel{Id: channelID}
|
||||
mockGroups := []*model.GroupWithSchemeAdmin{
|
||||
{Group: model.Group{Name: model.NewString("group1")}},
|
||||
{Group: model.Group{Name: model.NewString("group2")}},
|
||||
{Group: model.Group{Name: model.NewPointer("group1")}},
|
||||
{Group: model.Group{Name: model.NewPointer("group2")}},
|
||||
}
|
||||
|
||||
groupOpts := &model.GroupSearchOpts{
|
||||
@@ -761,7 +761,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
arg := teamID
|
||||
args := []string{arg}
|
||||
cmd := &cobra.Command{}
|
||||
team := &model.Team{Id: teamID, GroupConstrained: model.NewBool(true)}
|
||||
team := &model.Team{Id: teamID, GroupConstrained: model.NewPointer(true)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -784,7 +784,7 @@ func (s *MmctlUnitTestSuite) TestTeamGroupStatusCmd() {
|
||||
arg := teamID
|
||||
args := []string{arg}
|
||||
cmd := &cobra.Command{}
|
||||
team := &model.Team{Id: teamID, GroupConstrained: model.NewBool(false)}
|
||||
team := &model.Team{Id: teamID, GroupConstrained: model.NewPointer(false)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -872,7 +872,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
cmd := &cobra.Command{}
|
||||
|
||||
team := &model.Team{Id: teamID}
|
||||
channel := &model.Channel{Id: channelID, GroupConstrained: model.NewBool(true)}
|
||||
channel := &model.Channel{Id: channelID, GroupConstrained: model.NewPointer(true)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -904,7 +904,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupStatusCmd() {
|
||||
cmd := &cobra.Command{}
|
||||
|
||||
team := &model.Team{Id: teamID}
|
||||
channel := &model.Channel{Id: channelID, GroupConstrained: model.NewBool(false)}
|
||||
channel := &model.Channel{Id: channelID, GroupConstrained: model.NewPointer(false)}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
@@ -968,7 +968,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
channelPart := "channel-id"
|
||||
mockChannel := model.Channel{Id: channelPart}
|
||||
channelArg := teamArg + ":" + channelPart
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewString("group-name")}}
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewPointer("group-name")}}
|
||||
mockGroups := []*model.GroupWithSchemeAdmin{group}
|
||||
groupOpts := &model.GroupSearchOpts{
|
||||
PageOpts: &model.PageOpts{
|
||||
@@ -997,7 +997,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(true)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -1117,7 +1117,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
channelPart := "channel-id"
|
||||
mockChannel := model.Channel{Id: channelPart}
|
||||
channelArg := teamArg + ":" + channelPart
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewString("group-name")}}
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewPointer("group-name")}}
|
||||
mockGroups := []*model.GroupWithSchemeAdmin{group}
|
||||
mockError := errors.New("mock error")
|
||||
groupOpts := &model.GroupSearchOpts{
|
||||
@@ -1147,7 +1147,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(true)}).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
@@ -1266,7 +1266,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
channelPart := "channel-id"
|
||||
mockChannel := model.Channel{Id: channelPart}
|
||||
channelArg := teamArg + ":" + channelPart
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewString("group-name")}}
|
||||
group := &model.GroupWithSchemeAdmin{Group: model.Group{Name: model.NewPointer("group-name")}}
|
||||
mockGroups := []*model.GroupWithSchemeAdmin{group}
|
||||
mockError := errors.New("mock error")
|
||||
groupOpts := &model.GroupSearchOpts{
|
||||
@@ -1302,7 +1302,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupEnableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(true)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(true)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -1337,7 +1337,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(false)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -1436,7 +1436,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(false)}).
|
||||
Return(&mockChannel, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -1531,7 +1531,7 @@ func (s *MmctlUnitTestSuite) TestChannelGroupDisableCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewBool(false)}).
|
||||
PatchChannel(context.TODO(), channelPart, &model.ChannelPatch{GroupConstrained: model.NewPointer(false)}).
|
||||
Return(nil, &model.Response{}, mockError).
|
||||
Times(1)
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ func (s *MmctlUnitTestSuite) TestIntegrityCmd() {
|
||||
ChildIdAttr: "childIdAttr",
|
||||
Records: []model.OrphanedRecord{
|
||||
{
|
||||
ParentId: model.NewString("parentId"),
|
||||
ChildId: model.NewString("childId"),
|
||||
ParentId: model.NewPointer("parentId"),
|
||||
ChildId: model.NewPointer("childId"),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -82,8 +82,8 @@ func (s *MmctlUnitTestSuite) TestIntegrityCmd() {
|
||||
ChildIdAttr: "childIdAttr",
|
||||
Records: []model.OrphanedRecord{
|
||||
{
|
||||
ParentId: model.NewString("parentId"),
|
||||
ChildId: model.NewString("childId"),
|
||||
ParentId: model.NewPointer("parentId"),
|
||||
ChildId: model.NewPointer("childId"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ func convertBotToUser(c client.Client, cmd *cobra.Command, userArgs []string) er
|
||||
return errors.New("username is empty")
|
||||
}
|
||||
} else {
|
||||
up.Username = model.NewString(username)
|
||||
up.Username = model.NewPointer(username)
|
||||
}
|
||||
|
||||
email, _ := cmd.Flags().GetString("email")
|
||||
@@ -957,27 +957,27 @@ func convertBotToUser(c client.Client, cmd *cobra.Command, userArgs []string) er
|
||||
return errors.New("email is empty")
|
||||
}
|
||||
} else {
|
||||
up.Email = model.NewString(email)
|
||||
up.Email = model.NewPointer(email)
|
||||
}
|
||||
|
||||
nickname, _ := cmd.Flags().GetString("nickname")
|
||||
if nickname != "" {
|
||||
up.Nickname = model.NewString(nickname)
|
||||
up.Nickname = model.NewPointer(nickname)
|
||||
}
|
||||
|
||||
firstname, _ := cmd.Flags().GetString("firstname")
|
||||
if firstname != "" {
|
||||
up.FirstName = model.NewString(firstname)
|
||||
up.FirstName = model.NewPointer(firstname)
|
||||
}
|
||||
|
||||
lastname, _ := cmd.Flags().GetString("lastname")
|
||||
if lastname != "" {
|
||||
up.LastName = model.NewString(lastname)
|
||||
up.LastName = model.NewPointer(lastname)
|
||||
}
|
||||
|
||||
locale, _ := cmd.Flags().GetString("locale")
|
||||
if locale != "" {
|
||||
up.Locale = model.NewString(locale)
|
||||
up.Locale = model.NewPointer(locale)
|
||||
}
|
||||
|
||||
systemAdmin, _ := cmd.Flags().GetBool("system-admin")
|
||||
|
||||
@@ -1070,7 +1070,7 @@ func (s *MmctlE2ETestSuite) TestMigrateAuthCmd() {
|
||||
ldapUser, appErr := s.th.App.CreateUser(s.th.Context, &model.User{
|
||||
Email: s.th.GenerateTestEmail(),
|
||||
Username: model.NewId(),
|
||||
AuthData: model.NewString("test.user.1"),
|
||||
AuthData: model.NewPointer("test.user.1"),
|
||||
AuthService: model.UserAuthServiceLdap,
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
@@ -1078,7 +1078,7 @@ func (s *MmctlE2ETestSuite) TestMigrateAuthCmd() {
|
||||
samlUser, appErr := s.th.App.CreateUser(s.th.Context, &model.User{
|
||||
Email: "success+devone@simulator.amazonses.com",
|
||||
Username: "dev.one",
|
||||
AuthData: model.NewString("dev.one"),
|
||||
AuthData: model.NewPointer("dev.one"),
|
||||
AuthService: model.UserAuthServiceSaml,
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
@@ -1107,7 +1107,7 @@ func (s *MmctlE2ETestSuite) TestMigrateAuthCmd() {
|
||||
s.Require().NoError(err)
|
||||
defer func() {
|
||||
_, appErr := s.th.App.UpdateUserAuth(s.th.Context, ldapUser.Id, &model.UserAuth{
|
||||
AuthData: model.NewString("test.user.1"),
|
||||
AuthData: model.NewPointer("test.user.1"),
|
||||
AuthService: model.UserAuthServiceLdap,
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
@@ -1136,7 +1136,7 @@ func (s *MmctlE2ETestSuite) TestMigrateAuthCmd() {
|
||||
s.Require().NoError(err)
|
||||
defer func() {
|
||||
_, appErr := s.th.App.UpdateUserAuth(s.th.Context, samlUser.Id, &model.UserAuth{
|
||||
AuthData: model.NewString("dev.one"),
|
||||
AuthData: model.NewPointer("dev.one"),
|
||||
AuthService: model.UserAuthServiceSaml,
|
||||
})
|
||||
s.Require().Nil(appErr)
|
||||
|
||||
@@ -2607,9 +2607,9 @@ func (s *MmctlUnitTestSuite) TestUserConvertCmd() {
|
||||
mockBotUser := model.User{Id: "example", Username: userNameArg, IsBot: true}
|
||||
|
||||
userPatch := model.UserPatch{
|
||||
Email: model.NewString("example@example.com"),
|
||||
Password: model.NewString("password"),
|
||||
Username: model.NewString("example-user"),
|
||||
Email: model.NewPointer("example@example.com"),
|
||||
Password: model.NewPointer("password"),
|
||||
Username: model.NewPointer("example-user"),
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{}
|
||||
@@ -2687,9 +2687,9 @@ func (s *MmctlUnitTestSuite) TestUserConvertCmd() {
|
||||
mockBotUser := model.User{Id: "example", Username: userNameArg, IsBot: true}
|
||||
|
||||
userPatch := model.UserPatch{
|
||||
Email: model.NewString("example@example.com"),
|
||||
Password: model.NewString("password"),
|
||||
Username: model.NewString("example-user"),
|
||||
Email: model.NewPointer("example@example.com"),
|
||||
Password: model.NewPointer("password"),
|
||||
Username: model.NewPointer("example-user"),
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{}
|
||||
|
||||
Ссылка в новой задаче
Block a user