Test 7 Pushers created with a the same access token are not deleted on password change

This commit is contained in:
Dan Peleg 2021-05-03 21:33:38 +03:00
parent 4c4cf8020a
commit 763354e371
11 changed files with 335 additions and 71 deletions

View file

@ -36,6 +36,7 @@ const (
PerformPusherDeletionPath = "/userapi/performPusherDeletion"
PerformLastSeenUpdatePath = "/userapi/performLastSeenUpdate"
PerformDeviceUpdatePath = "/userapi/performDeviceUpdate"
PerformPusherUpdatePath = "/userapi/performPusherUpdate"
PerformAccountDeactivationPath = "/userapi/performAccountDeactivation"
PerformOpenIDTokenCreationPath = "/userapi/performOpenIDTokenCreation"
@ -137,6 +138,18 @@ func (h *httpUserInternalAPI) PerformPusherCreation(
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
func (h *httpUserInternalAPI) PerformPusherUpdate(
ctx context.Context,
request *api.PerformPusherUpdateRequest,
response *api.PerformPusherUpdateResponse,
) error {
span, ctx := opentracing.StartSpanFromContext(ctx, "PerformPusherUpdate")
defer span.Finish()
apiURL := h.apiURL + PerformPusherUpdatePath
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response)
}
func (h *httpUserInternalAPI) PerformPusherDeletion(
ctx context.Context,
request *api.PerformPusherDeletionRequest,

View file

@ -65,6 +65,19 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
internalAPIMux.Handle(PerformPusherUpdatePath,
httputil.MakeInternalAPI("performPusherUpdate", func(req *http.Request) util.JSONResponse {
request := api.PerformPusherUpdateRequest{}
response := api.PerformPusherUpdateResponse{}
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
return util.MessageResponse(http.StatusBadRequest, err.Error())
}
if err := s.PerformPusherUpdate(req.Context(), &request, &response); err != nil {
return util.ErrorResponse(err)
}
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
internalAPIMux.Handle(PerformDeviceCreationPath,
httputil.MakeInternalAPI("performDeviceCreation", func(req *http.Request) util.JSONResponse {
request := api.PerformDeviceCreationRequest{}