[MM-37108] Fix possible nil dereference in team edition (#17933)

* Fix possible nil dereference

* Fix translation

* Switch to StatusForbidden

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Claudio Costa
2021-07-27 13:07:40 +02:00
коммит произвёл GitHub
родитель 186475db3b
Коммит 75d6480393
3 изменённых файлов: 22 добавлений и 0 удалений

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

@@ -229,4 +229,12 @@ func TestRequestTrialLicense(t *testing.T) {
require.Equal(t, "api.license.add_license.unique_users.app_error", resp.Error.Id)
require.False(t, ok)
})
th.App.Srv().LicenseManager = nil
t.Run("trial license should fail if LicenseManager is nil", func(t *testing.T) {
ok, resp := th.SystemAdminClient.RequestTrialLicense(1)
CheckForbiddenStatus(t, resp)
require.False(t, ok)
require.Equal(t, "api.license.upgrade_needed.app_error", resp.Error.Id)
})
}