getRefreshTokenFromLogin performs a login and returns the refresh token from the response
(handler *gin.Engine)
| 194 | |
| 195 | // getRefreshTokenFromLogin performs a login and returns the refresh token from the response |
| 196 | func getRefreshTokenFromLogin(handler *gin.Engine) string { |
| 197 | r := gofight.New() |
| 198 | var refreshToken string |
| 199 | |
| 200 | r.POST("/login"). |
| 201 | SetJSON(gofight.D{ |
| 202 | "username": testAdmin, |
| 203 | "password": testAdmin, |
| 204 | }). |
| 205 | Run(handler, func(r gofight.HTTPResponse, rq gofight.HTTPRequest) { |
| 206 | if r.Code == http.StatusOK { |
| 207 | refreshToken = gjson.Get(r.Body.String(), "refresh_token").String() |
| 208 | } |
| 209 | }) |
| 210 | |
| 211 | return refreshToken |
| 212 | } |
| 213 | |
| 214 | func ginHandler(auth *GinJWTMiddleware) *gin.Engine { |
| 215 | gin.SetMode(gin.TestMode) |
no test coverage detected
searching dependent graphs…