test(users, settings): add e2e tests for ResetUsedSpace and WorkerQueueLen

This commit is contained in:
hexxa 2022-03-09 16:59:47 +08:00 committed by Hexxa
parent 4dcd2c56ca
commit 21593af444
10 changed files with 165 additions and 44 deletions

View file

@ -59,3 +59,17 @@ func (cl *SettingsClient) ReportErrors(reports *settings.ClientErrorReports, tok
Send(reports).
End()
}
func (cl *SettingsClient) WorkerQueueLen(token *http.Cookie) (*http.Response, *settings.WorkerQueueLenResp, []error) {
resp, body, errs := cl.r.Get(cl.url("/v1/settings/workers/queue-len")).
AddCookie(token).
End()
mResp := &settings.WorkerQueueLenResp{}
err := json.Unmarshal([]byte(body), mResp)
if err != nil {
errs = append(errs, err)
return nil, nil, errs
}
return resp, mResp, nil
}

View file

@ -187,3 +187,12 @@ func (cl *SingleUserClient) IsAuthed(token *http.Cookie) (*http.Response, string
AddCookie(token).
End()
}
func (cl *SingleUserClient) ResetUsedSpace(userID uint64, token *http.Cookie) (*http.Response, string, []error) {
return cl.r.Put(cl.url("/v1/users/used-space")).
Send(multiusers.ResetUsedSpaceReq{
UserID: userID,
}).
AddCookie(token).
End()
}