1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: tests

This commit is contained in:
Ferdinand Mütsch 2021-10-11 11:38:55 +02:00
parent 9451848ad4
commit ed9a7ccd5a

View File

@ -59,9 +59,11 @@ func TestAuthenticateMiddleware_tryGetUserByApiKeyQuery_Success(t *testing.T) {
testApiKey := "z5uig69cn9ut93n"
testUser := &models.User{ApiKey: testApiKey}
params := url.Values{}
params.Add("api_key", testApiKey)
mockRequest := &http.Request{
URL: &url.URL{
RawQuery: fmt.Sprintf("api_token=%s", testApiKey),
RawQuery: params.Encode(),
},
}
@ -79,10 +81,11 @@ func TestAuthenticateMiddleware_tryGetUserByApiKeyQuery_Success(t *testing.T) {
func TestAuthenticateMiddleware_tryGetUserByApiKeyQuery_Invalid(t *testing.T) {
testApiKey := "z5uig69cn9ut93n"
params := url.Values{}
params.Add("token", testApiKey)
mockRequest := &http.Request{
URL: &url.URL{
// Use the wrong parameter name.
RawQuery: fmt.Sprintf("token=%s", testApiKey),
RawQuery: params.Encode(),
},
}