diff --git a/model/client4.go b/model/client4.go index d6cc62ba0f..74b65948b0 100644 --- a/model/client4.go +++ b/model/client4.go @@ -8803,3 +8803,17 @@ func (c *Client4) GetWorkTemplatesByCategory(category string) ([]*WorkTemplate, err = json.NewDecoder(r.Body).Decode(&templates) return templates, BuildResponse(r), err } + +func (c *Client4) SubmitTrueUpReview(req map[string]any) (*Response, error) { + reqBytes, err := json.Marshal(req) + if err != nil { + return nil, NewAppError("SubmitTrueUpReview", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err) + } + r, err := c.DoAPIPostBytes(c.licenseRoute()+"/review", reqBytes) + if err != nil { + return BuildResponse(r), nil + } + defer closeBody(r) + + return BuildResponse(r), nil +} diff --git a/server/channels/api4/license_test.go b/server/channels/api4/license_test.go index 8769fae1fc..1a4b4a7803 100644 --- a/server/channels/api4/license_test.go +++ b/server/channels/api4/license_test.go @@ -484,7 +484,19 @@ func TestRequestTrueUpReview(t *testing.T) { th.App.Srv().SetLicense(model.NewTestLicense()) t.Run("returns status 200 when telemetry data sent", func(t *testing.T) { - resp, err := th.SystemAdminClient.DoAPIPost("/license/review", "") + th.Client.Login(th.SystemAdminUser.Email, th.SystemAdminUser.Password) + + cloud := mocks.CloudInterface{} + cloud.Mock.On("SubmitTrueUpReview", mock.Anything, mock.Anything).Return(nil) + + cloudImpl := th.App.Srv().Cloud + defer func() { + th.App.Srv().Cloud = cloudImpl + }() + th.App.Srv().Cloud = &cloud + + var reviewProfile map[string]any + resp, err := th.Client.SubmitTrueUpReview(reviewProfile) require.NoError(t, err) require.Equal(t, http.StatusOK, resp.StatusCode) }) @@ -521,14 +533,6 @@ func TestTrueUpReviewStatus(t *testing.T) { th.App.Srv().SetLicense(model.NewTestLicense()) t.Run("returns 200 when status retrieved", func(t *testing.T) { - cloud := mocks.CloudInterface{} - - cloudImpl := th.App.Srv().Cloud - defer func() { - th.App.Srv().Cloud = cloudImpl - }() - th.App.Srv().Cloud = &cloud - resp, err := th.SystemAdminClient.DoAPIGet("/license/review/status", "") require.NoError(t, err) require.Equal(t, http.StatusOK, resp.StatusCode)