mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: tests
This commit is contained in:
parent
9451848ad4
commit
ed9a7ccd5a
@ -59,9 +59,11 @@ func TestAuthenticateMiddleware_tryGetUserByApiKeyQuery_Success(t *testing.T) {
|
|||||||
testApiKey := "z5uig69cn9ut93n"
|
testApiKey := "z5uig69cn9ut93n"
|
||||||
testUser := &models.User{ApiKey: testApiKey}
|
testUser := &models.User{ApiKey: testApiKey}
|
||||||
|
|
||||||
|
params := url.Values{}
|
||||||
|
params.Add("api_key", testApiKey)
|
||||||
mockRequest := &http.Request{
|
mockRequest := &http.Request{
|
||||||
URL: &url.URL{
|
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) {
|
func TestAuthenticateMiddleware_tryGetUserByApiKeyQuery_Invalid(t *testing.T) {
|
||||||
testApiKey := "z5uig69cn9ut93n"
|
testApiKey := "z5uig69cn9ut93n"
|
||||||
|
|
||||||
|
params := url.Values{}
|
||||||
|
params.Add("token", testApiKey)
|
||||||
mockRequest := &http.Request{
|
mockRequest := &http.Request{
|
||||||
URL: &url.URL{
|
URL: &url.URL{
|
||||||
// Use the wrong parameter name.
|
RawQuery: params.Encode(),
|
||||||
RawQuery: fmt.Sprintf("token=%s", testApiKey),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user