package main

import (
	"testing"

	"github.com/pingcap/lark2es/pkg/config"
	"github.com/pingcap/lark2es/pkg/db"
)

func TestFetchDepartments(t *testing.T) {
	config.InitConfig("config", "yaml", "../etc")
	hrDB, _ := db.InitDb(config.GetString("db"))
	hrDB.AutoMigrate(&HREmployee{}, &HRDepartment{}, &HREmployeeDepartment{})
	LoadAndSaveEmployees(hrDB)
	//FetchDepartments(hrDB)
}

func TestCheckGithub(t *testing.T) {
	config.InitConfig("config", "yaml", "../etc")
	//userPoolId := "6114dd1f753f9920f1ca06cf"
	//appSecret := os.Getenv("appsecret")
	//client := management.NewClient(userPoolId, appSecret, private_host)
	//
	//request := model.FindUserRequest{}
	//email := "kathleen.li@pingcap.com"
	//request.Email = &email
	//user, err := client.FindUser(&request)
	//if err != nil {
	//	t.Fatal(err)
	//}
	//t.Log(user)
	employee := HREmployee{GithubId: "breezewish", Comfirm: 1}
	CheckGithub(config.GetString("githubtoken"), &employee)
	t.Logf("%+v", employee.GH_Email)
}
