44 lines
1.5 KiB
Go
44 lines
1.5 KiB
Go
package sc
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestLogin(t *testing.T) {
|
|
login := NewLogin("13551503012", "XIAOzhi520")
|
|
login.Login(context.Background())
|
|
login.GetClient()
|
|
|
|
}
|
|
|
|
func TestStudy(t *testing.T) {
|
|
login := NewLogin("13551503012", "XIAOzhi520")
|
|
//ticket := login.Login(context.Background())
|
|
//token := login.OOSLogin(context.Background(), ticket)
|
|
client := login.GetClient()
|
|
course := NewCourse("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkZXZpY2VUeXBlIjoid2ViIiwibG9naW5UeXBlIjoidXNlcnJlYWxtIiwiZXhwIjoxNzY1MjU3NDI1LCJ1c2VySWQiOiIxOTk4MDI1NjQ1NzU5ODM2MTYwIn0.PL5Roy0t9v0mK-ucK73IZg2qTZfw0YhW1sVxG1SYetU", client)
|
|
courseList := course.GetCourseList(context.Background())
|
|
for _, c := range courseList {
|
|
chapterList := course.GetChapterList(context.Background(), c.Id)
|
|
for _, ch := range chapterList {
|
|
for _, sec := range ch.SubSection {
|
|
course.Study(context.Background(), c, ch, sec)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestGetProcess(t *testing.T) {
|
|
login := NewLogin("13551503012", "XIAOzhi520")
|
|
//ticket := login.Login(context.Background())
|
|
//token := login.OOSLogin(context.Background(), ticket)
|
|
client := login.GetClient()
|
|
course := NewCourse("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkZXZpY2VUeXBlIjoid2ViIiwibG9naW5UeXBlIjoidXNlcnJlYWxtIiwiZXhwIjoxNzY1MjU3NDI1LCJ1c2VySWQiOiIxOTk4MDI1NjQ1NzU5ODM2MTYwIn0.PL5Roy0t9v0mK-ucK73IZg2qTZfw0YhW1sVxG1SYetU", client)
|
|
courseList := course.GetCourseList(context.Background())
|
|
for _, c := range courseList {
|
|
finished, total := course.GetCourseProcees(context.Background(), c.Id)
|
|
t.Log(finished, total)
|
|
}
|
|
}
|