MM-44509 - subscription change not reflected after trial (#20352)

* MM-44509 - subscription change not reflected after trial

* fix the tests

* receive the subscription id as param, defer the cache invalidation

* validate business email with body request

* update api request to accept json body payload

* fix unit tests

* fix tests after merge conflict fixes

Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Pablo Andrés Vélez Vidal
2022-06-21 01:40:27 +02:00
коммит произвёл GitHub
родитель f1ddd3ad38
Коммит 2b8d63b606
4 изменённых файлов: 46 добавлений и 16 удалений

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

@@ -125,7 +125,7 @@ func Test_requestTrial(t *testing.T) {
IsPaidTier: "false",
}
newValidBusinessEmail := model.ValidateBusinessEmailRequest{Email: ""}
newValidBusinessEmail := model.StartCloudTrialRequest{Email: ""}
t.Run("NON Admin users are UNABLE to request the trial", func(t *testing.T) {
th := Setup(t).InitBasic()
@@ -139,6 +139,7 @@ func Test_requestTrial(t *testing.T) {
cloud.Mock.On("GetSubscription", mock.Anything).Return(subscription, nil)
cloud.Mock.On("RequestCloudTrial", mock.Anything, mock.Anything, "").Return(subscription, nil)
cloud.Mock.On("InvalidateCaches").Return(nil)
cloudImpl := th.App.Srv().Cloud
defer func() {
@@ -164,6 +165,7 @@ func Test_requestTrial(t *testing.T) {
cloud.Mock.On("GetSubscription", mock.Anything).Return(subscription, nil)
cloud.Mock.On("RequestCloudTrial", mock.Anything, mock.Anything, "").Return(subscription, nil)
cloud.Mock.On("InvalidateCaches").Return(nil)
cloudImpl := th.App.Srv().Cloud
defer func() {
@@ -193,6 +195,7 @@ func Test_requestTrial(t *testing.T) {
cloud.Mock.On("GetSubscription", mock.Anything).Return(subscription, nil)
cloud.Mock.On("RequestCloudTrial", mock.Anything, mock.Anything, "valid.email@mattermost.com").Return(subscription, nil)
cloud.Mock.On("InvalidateCaches").Return(nil)
cloudImpl := th.App.Srv().Cloud
defer func() {
@@ -215,6 +218,8 @@ func Test_validateBusinessEmail(t *testing.T) {
th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)
validateBusinessEmail := model.ValidateBusinessEmailRequest{Email: ""}
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
cloud := mocks.CloudInterface{}
@@ -229,7 +234,7 @@ func Test_validateBusinessEmail(t *testing.T) {
}()
th.App.Srv().Cloud = &cloud
_, err := th.Client.ValidateBusinessEmail()
_, err := th.Client.ValidateBusinessEmail(&validateBusinessEmail)
require.Error(t, err)
})
}