* MM-34434: Added 'is_trial' boolean to all trial license requests and to the License struct.

* MM-34434: Generalized the concept of a license request.

* MM-34434: Verifies JSON field of license instance is set.

* MM-34434: Added missing client param.

* MM-34434: Added some tests of the request trial API endpoint.

* MM-34434: Removed comment.

* fix broken test (#17348)

* Add missing wrapped errors (#17339)

* Improve document extraction and including a document extraction command (#17183)

* Add extract documents content command

* Adding the extraction command and making the pure go pdf library as secondary option

* Improving the memory usage and docextractor interface

* Enable content extraction by default in all the instances

* Tiny improvement on archive indexing

* Adding App interface generation and the opentracing layer

* Fixing linter errors

* Addressing PR review comments

* Addressing PR review comments

* Update en.json (#17356)

Automatic Merge

* adding new feature flag (#17308)

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* Bump no_output_timeout to 2 hours (#17358)

* log invalid username (#17345)

Automatic Merge

* MM-34434: Added missing client param.

MM-34434: Added some tests of the request trial API endpoint.

MM-34434: Removed comment.

* MM-34434: Switched to a hard-coded true value.

* MM-34434: Reverts test change.

* MM-34434: Removes unnecessary field.

* MM-34434: Tests that is_trial is hard-coded by TrialLicenseRequest.

* MM-34434: Removed accidental commit.

* MM-34434: Removes unnecessary is_trial key from JSON payload.

* MM-34434: Reverts to old pointer receiver variable name.

* MM-34434: Removes test.

Co-authored-by: Hossein <hahmadia@users.noreply.github.com>
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
Co-authored-by: Amy Blais <amy_blais@hotmail.com>
Co-authored-by: Ben Cooke <benkcooke@gmail.com>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Max Erenberg <max.erenberg@mattermost.com>
Этот коммит содержится в:
Martin Kraft
2021-06-11 17:20:41 -04:00
коммит произвёл GitHub
родитель 0eb50a6777
Коммит ef2c97a5ec
4 изменённых файлов: 33 добавлений и 1 удалений

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

@@ -111,3 +111,32 @@ func TestRemoveLicenseFile(t *testing.T) {
require.True(t, ok)
})
}
func TestRequestTrialLicense(t *testing.T) {
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = "http://localhost:8065/" })
t.Run("permission denied", func(t *testing.T) {
ok, resp := th.Client.RequestTrialLicense(1000)
CheckForbiddenStatus(t, resp)
require.False(t, ok)
})
t.Run("blank site url", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = "" })
defer th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = "http://localhost:8065/" })
ok, resp := th.SystemAdminClient.RequestTrialLicense(1000)
CheckBadRequestStatus(t, resp)
require.Equal(t, "api.license.request_trial_license.no-site-url.app_error", resp.Error.Id)
require.False(t, ok)
})
t.Run("trial license user count less than current users", func(t *testing.T) {
ok, resp := th.SystemAdminClient.RequestTrialLicense(1)
CheckBadRequestStatus(t, resp)
require.Equal(t, "api.license.add_license.unique_users.app_error", resp.Error.Id)
require.False(t, ok)
})
}

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

@@ -5805,7 +5805,7 @@ func (c *Client4) GetChannelMemberCountsByGroup(channelID string, includeTimezon
// RequestTrialLicense will request a trial license and install it in the server
func (c *Client4) RequestTrialLicense(users int) (bool, *Response) {
b, _ := json.Marshal(map[string]int{"users": users})
b, _ := json.Marshal(map[string]interface{}{"users": users, "terms_accepted": true})
r, err := c.DoApiPost("/trial-license", string(b))
if err != nil {
return false, BuildErrorResponse(r, err)

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

@@ -31,6 +31,7 @@ type License struct {
Features *Features `json:"features"`
SkuName string `json:"sku_name"`
SkuShortName string `json:"sku_short_name"`
IsTrial bool `json:"is_trial"`
}
type Customer struct {

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

@@ -158,6 +158,7 @@ func TestLicenseToFromJson(t *testing.T) {
Company: NewId(),
},
Features: &f,
IsTrial: true,
}
j := l.ToJson()
@@ -169,6 +170,7 @@ func TestLicenseToFromJson(t *testing.T) {
CheckInt64(t, l1.IssuedAt, l.IssuedAt)
CheckInt64(t, l1.StartsAt, l.StartsAt)
CheckInt64(t, l1.ExpiresAt, l.ExpiresAt)
CheckBool(t, l1.IsTrial, l.IsTrial)
CheckString(t, l1.Customer.Id, l.Customer.Id)
CheckString(t, l1.Customer.Name, l.Customer.Name)