Files
openserp/yandex/search_test.go

44 lines
1.0 KiB
Go
Raw Permalink Normal View History

//go:build integration
// +build integration
2023-06-23 04:08:00 +03:00
package yandex
import (
"context"
2023-06-23 04:08:00 +03:00
"testing"
2023-06-23 04:16:45 +03:00
"github.com/karust/openserp/core"
"github.com/karust/openserp/testutil"
"github.com/karust/openserp/testutil/ithelper"
2023-06-23 04:08:00 +03:00
)
func TestSearchYandex(t *testing.T) {
testutil.RequireIntegration(t)
2023-06-23 04:08:00 +03:00
browser := ithelper.CreateBrowser(t)
2023-06-28 22:20:19 +03:00
yand := New(*browser, core.SearchEngineOptions{})
2023-06-23 04:08:00 +03:00
query := core.Query{Text: "HEY", Limit: 10}
results, err := yand.Search(context.Background(), query)
ithelper.HandleError(t, "yandex web search", err)
2023-06-23 04:08:00 +03:00
if len(results) == 0 {
t.Fatalf("[SearchYandex] returned empty result")
}
}
2023-07-05 18:42:14 +03:00
func TestImageYandex(t *testing.T) {
testutil.RequireIntegration(t)
browser := ithelper.CreateBrowser(t)
2023-07-05 18:42:14 +03:00
yand := New(*browser, core.SearchEngineOptions{})
2024-05-12 01:41:53 +03:00
query := core.Query{Text: "furry tiger", Limit: 30}
results, err := yand.SearchImage(context.Background(), query)
ithelper.HandleError(t, "yandex image search", err)
2023-07-05 18:42:14 +03:00
if len(results) == 0 {
2023-07-05 18:42:14 +03:00
t.Fatalf("[ImageYandex] returned empty result")
}
}