package lsxd

import (
	"ai_scheduler/internal/config"
	"ai_scheduler/utils"
	"context"
	"testing"
)

func TestGetToken(t *testing.T) {

	rdb := utils.NewRdb(&config.Config{
		Redis: config.Redis{
			Host: "47.97.27.195:6379",
			Pass: "lansexiongdi@666",
			Key:  "report-api-test",
		},
	})

	login := NewLogin(&config.Config{
		LSXD: config.LSXDConfig{
			LoginURL:      "https://api.user.1688sup.com/v1/login/phone",
			Phone:         "ORlviZN7N06W2+WKLe76xg==",
			Password:      "V5Uh8C4bamEM6UQZh4TCeQ==",
			CheckTokenURL: "https://api.user.1688sup.com/v1/user/welcome",
		},
	}, rdb)
	token := login.GetToken(context.Background())
	if token == "" {
		t.Errorf("token is empty")
	}

	t.Logf("token: %s", token)
}
