Add integration tests for multiple search engines and enhance error handling

- Implement integration tests for Baidu, Bing, DuckDuckGo, Google, and Yandex.
- Refactor test utility functions to avoid core import cycles.
This commit is contained in:
Rustem Kamalov
2026-04-14 02:05:58 +03:00
parent de59d07d47
commit ecacfab4d6
10 changed files with 321 additions and 42 deletions

View File

@@ -7,6 +7,8 @@ import (
)
const IntegrationEnv = "OPENSERP_INTEGRATION_TESTS"
const IntegrationHeadfulEnv = "OPENSERP_INTEGRATION_HEADFUL"
const IntegrationStrictEnv = "OPENSERP_INTEGRATION_STRICT"
func RequireIntegration(t *testing.T) {
t.Helper()
@@ -15,6 +17,16 @@ func RequireIntegration(t *testing.T) {
}
}
func IntegrationHeadful() bool {
value := strings.TrimSpace(strings.ToLower(os.Getenv(IntegrationHeadfulEnv)))
return value == "1" || value == "true" || value == "yes"
}
func IntegrationStrict() bool {
value := strings.TrimSpace(strings.ToLower(os.Getenv(IntegrationStrictEnv)))
return value == "1" || value == "true" || value == "yes"
}
func RequireEnv(t *testing.T, key string) string {
t.Helper()
value := strings.TrimSpace(os.Getenv(key))