Fix: login flow
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"github.com/go-resty/resty/v2"
|
||||
)
|
||||
|
||||
var client *resty.Client
|
||||
|
||||
type genLoginUrlPayload struct {
|
||||
LoginUrl string `json:"loginUrl"`
|
||||
}
|
||||
@@ -16,8 +18,8 @@ type loginPayload struct {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
func TestLogin(t *testing.T) {
|
||||
client := resty.New()
|
||||
func Test_01_Login(t *testing.T) {
|
||||
client = resty.New()
|
||||
|
||||
var payload genLoginUrlPayload
|
||||
resp, err := client.R().
|
||||
@@ -37,7 +39,7 @@ func TestLogin(t *testing.T) {
|
||||
|
||||
resp, err = client.R().
|
||||
SetBody(loginPayload{Token: loginUrl.Query().Get("token")}).
|
||||
Post(loginUrl.Scheme + "://" + loginUrl.Host + loginUrl.Path)
|
||||
Post(loginUrl.Scheme + "://" + loginUrl.Host + "/auth/login")
|
||||
if err != nil || resp.StatusCode() != http.StatusOK {
|
||||
t.Fatal("failed to login")
|
||||
}
|
||||
6
tests/02_getImages_test.go
Normal file
6
tests/02_getImages_test.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_02_GetImages(t *testing.T) {
|
||||
}
|
||||
Reference in New Issue
Block a user