mirror of
https://github.com/karust/openserp.git
synced 2026-08-24 17:00:06 +08:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user