github.com/mailgun/mailgun-go/v3@v3.6.4/acceptance_test.go (about) 1 package mailgun 2 3 import ( 4 "fmt" 5 "os" 6 "testing" 7 ) 8 9 // Return the variable missing which caused the test to be skipped 10 func SkipNetworkTest() string { 11 for _, env := range []string{"MG_DOMAIN", "MG_API_KEY", "MG_EMAIL_TO", "MG_PUBLIC_API_KEY"} { 12 if os.Getenv(env) == "" { 13 return fmt.Sprintf("'%s' missing from environment skipping...", env) 14 } 15 } 16 return "" 17 } 18 19 func spendMoney(t *testing.T, tFunc func()) { 20 ok := os.Getenv("MG_SPEND_MONEY") 21 if ok != "" { 22 tFunc() 23 } else { 24 t.Log("Money spending not allowed, not running function.") 25 } 26 }