[MM-42713] - Remove cloud user limit restrictions (#19835)

* [MM-42713] - Remove cloud user limit restrictions

* remove unused code

* fix translations

* feedback impl-1

* enterprise code clean up

* feedback impl-2

* fix mocks

* fix translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Allan Guwatudde
2022-03-31 18:24:38 +03:00
коммит произвёл GitHub
родитель 67d57fc400
Коммит fa56ee9d9a
29 изменённых файлов: 0 добавлений и 1866 удалений

Просмотреть файл

@@ -2183,46 +2183,6 @@ func assertWebsocketEventUserUpdatedWithEmail(t *testing.T, client *model.WebSoc
}
func TestUpdateUserActive(t *testing.T) {
t.Run("not activating more users when cloud license users at limit", func(t *testing.T) {
// create 5 active users
th := Setup(t).InitBasic()
defer th.TearDown()
cloudMock := &mocks.CloudInterface{}
cloudMock.Mock.On(
"GetSubscription", mock.Anything,
).Return(&model.Subscription{
ID: "MySubscriptionID",
CustomerID: "MyCustomer",
ProductID: "SomeProductId",
AddOns: []string{},
StartAt: 1000000000,
EndAt: 2000000000,
CreateAt: 1000000000,
Seats: 100,
DNS: "some.dns.server",
IsPaidTier: "false",
}, nil)
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
th.App.Srv().Cloud = cloudMock
user := th.BasicUser
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.TeamSettings.EnableUserDeactivation = true
*cfg.ExperimentalSettings.CloudUserLimit = 4
})
// deactivate 5th user, now we have 4 active users and are at limit
_, err := th.SystemAdminClient.UpdateUserActive(user.Id, false)
require.NoError(t, err)
// try and reactivate 5th user, not allowed because it exceeds the set cloud user limit
resp, err := th.SystemAdminClient.UpdateUserActive(user.Id, true)
CheckErrorMessage(t, err, "Unable to activate more users as the cloud account is over capacity.")
CheckBadRequestStatus(t, resp)
})
t.Run("basic tests", func(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()