* Revert "MM-51482_Create Apps Category and link to bots DM (#22918)" This reverts commit1051925eec. * Revert "MM-51711_Feature flag: APPS sidebar category (#22766)" This reverts commit9156205178.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
16ad573979
Коммит
6a5bb53963
@@ -1025,119 +1025,6 @@ func TestJoinUserToTeam(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestJoinUserToTeamWithAppsCategoryEnabled(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.AppsSidebarCategory = true })
|
||||
|
||||
id := model.NewId()
|
||||
team := &model.Team{
|
||||
DisplayName: "dn_" + id,
|
||||
Name: "name" + id,
|
||||
Email: "success+" + id + "@simulator.amazonses.com",
|
||||
Type: model.TeamOpen,
|
||||
}
|
||||
|
||||
_, err := th.App.CreateTeam(th.Context, team)
|
||||
require.Nil(t, err, "Should create a new team")
|
||||
|
||||
maxUsersPerTeam := th.App.Config().TeamSettings.MaxUsersPerTeam
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = maxUsersPerTeam })
|
||||
th.App.PermanentDeleteTeam(th.Context, team)
|
||||
}()
|
||||
one := 1
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = &one })
|
||||
|
||||
t.Run("new join", func(t *testing.T) {
|
||||
user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser, _ := th.App.CreateUser(th.Context, &user)
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user)
|
||||
|
||||
_, appErr := th.App.JoinUserToTeam(th.Context, team, ruser, "")
|
||||
require.Nil(t, appErr, "Should return no error")
|
||||
})
|
||||
|
||||
t.Run("new join with limit problem", func(t *testing.T) {
|
||||
user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser1, _ := th.App.CreateUser(th.Context, &user1)
|
||||
user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser2, _ := th.App.CreateUser(th.Context, &user2)
|
||||
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user1)
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user2)
|
||||
|
||||
_, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id)
|
||||
require.Nil(t, appErr, "Should return no error")
|
||||
|
||||
_, appErr = th.App.JoinUserToTeam(th.Context, team, ruser2, ruser1.Id)
|
||||
require.NotNil(t, appErr, "Should fail")
|
||||
})
|
||||
|
||||
t.Run("re-join after leaving with limit problem", func(t *testing.T) {
|
||||
user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser1, _ := th.App.CreateUser(th.Context, &user1)
|
||||
|
||||
user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser2, _ := th.App.CreateUser(th.Context, &user2)
|
||||
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user1)
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user2)
|
||||
|
||||
_, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id)
|
||||
require.Nil(t, appErr, "Should return no error")
|
||||
appErr = th.App.LeaveTeam(th.Context, team, ruser1, ruser1.Id)
|
||||
require.Nil(t, appErr, "Should return no error")
|
||||
_, appErr = th.App.JoinUserToTeam(th.Context, team, ruser2, ruser2.Id)
|
||||
require.Nil(t, appErr, "Should return no error")
|
||||
|
||||
_, appErr = th.App.JoinUserToTeam(th.Context, team, ruser1, ruser2.Id)
|
||||
require.NotNil(t, appErr, "Should fail")
|
||||
})
|
||||
|
||||
t.Run("new join with correct scheme_admin value from group syncable", func(t *testing.T) {
|
||||
user1 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser1, _ := th.App.CreateUser(th.Context, &user1)
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user1)
|
||||
|
||||
group := th.CreateGroup()
|
||||
|
||||
_, err = th.App.UpsertGroupMember(group.Id, user1.Id)
|
||||
require.Nil(t, err)
|
||||
|
||||
gs, err := th.App.UpsertGroupSyncable(&model.GroupSyncable{
|
||||
AutoAdd: true,
|
||||
SyncableId: team.Id,
|
||||
Type: model.GroupSyncableTypeTeam,
|
||||
GroupId: group.Id,
|
||||
SchemeAdmin: false,
|
||||
})
|
||||
require.Nil(t, err)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.MaxUsersPerTeam = model.NewInt(999) })
|
||||
|
||||
tm1, appErr := th.App.JoinUserToTeam(th.Context, team, ruser1, "")
|
||||
require.Nil(t, appErr)
|
||||
require.False(t, tm1.SchemeAdmin)
|
||||
|
||||
user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@example.com", Nickname: "Darth Vader", Username: "vader" + model.NewId(), Password: "passwd1", AuthService: ""}
|
||||
ruser2, _ := th.App.CreateUser(th.Context, &user2)
|
||||
defer th.App.PermanentDeleteUser(th.Context, &user2)
|
||||
|
||||
_, err = th.App.UpsertGroupMember(group.Id, user2.Id)
|
||||
require.Nil(t, err)
|
||||
|
||||
gs.SchemeAdmin = true
|
||||
_, err = th.App.UpdateGroupSyncable(gs)
|
||||
require.Nil(t, err)
|
||||
|
||||
tm2, appErr := th.App.JoinUserToTeam(th.Context, team, ruser2, "")
|
||||
require.Nil(t, appErr)
|
||||
require.True(t, tm2.SchemeAdmin)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLeaveTeamPanic(t *testing.T) {
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user