Тестирование: поверхностный парсинг

This commit is contained in:
far-galaxy 2023-07-31 13:00:40 +04:00
parent 7ec585e115
commit dce711072c
2 changed files with 28 additions and 1 deletions

View File

@ -75,7 +75,10 @@ func Parse(p Page) (*WeekShedule, error) {
var lessons [][]Lesson
doc.Find(".schedule__item:not(.schedule__head)").Each(func(i int, s *goquery.Selection) {
sl := ParseLesson(s, p.IsGroup, p.ID)
//sl := ParseLesson(s, p.IsGroup, p.ID)
sl := []Lesson{
{},
}
lessons = append(lessons, sl)
})

View File

@ -72,3 +72,27 @@ func TestDownloadShedule(t *testing.T) {
log.Println(err)
}
}
func TestParse(t *testing.T) {
headURL = "http://127.0.0.1:5000"
page, err := DownloadSheduleById(530996168, true, 1)
if err != nil {
log.Println(err)
}
_, err = Parse(page)
if err != nil {
log.Println(err)
}
for i := 1; i < 6; i++ {
page, err := DownloadSheduleById(123, true, i)
if err != nil {
log.Println(err)
return
}
_, err = Parse(page)
if err != nil {
log.Println(err)
}
}
}