mirror of
https://github.com/karust/openserp.git
synced 2026-08-25 17:22:09 +08:00
26 lines
488 B
Go
26 lines
488 B
Go
|
|
package testutil
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
const IntegrationEnv = "OPENSERP_INTEGRATION_TESTS"
|
||
|
|
|
||
|
|
func RequireIntegration(t *testing.T) {
|
||
|
|
t.Helper()
|
||
|
|
if strings.TrimSpace(os.Getenv(IntegrationEnv)) != "1" {
|
||
|
|
t.Skipf("set %s=1 to run integration tests", IntegrationEnv)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func RequireEnv(t *testing.T, key string) string {
|
||
|
|
t.Helper()
|
||
|
|
value := strings.TrimSpace(os.Getenv(key))
|
||
|
|
if value == "" {
|
||
|
|
t.Skipf("set %s to run this integration test", key)
|
||
|
|
}
|
||
|
|
return value
|
||
|
|
}
|