github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/open/http_test.go (about) 1 package open 2 3 import ( 4 "os" 5 "testing" 6 7 _ "github.com/lmorg/murex/builtins/types/json" 8 "github.com/lmorg/murex/lang" 9 "github.com/lmorg/murex/lang/types" 10 "github.com/lmorg/murex/test/count" 11 ) 12 13 func TestHttp(t *testing.T) { 14 if os.Getenv("MUREX_TEST_NO_HTTP") != "" { 15 t.Skip("Env var MUREX_TEST_NO_HTTP set so skipping this test") 16 } 17 18 count.Tests(t, 1) 19 20 t.Logf("This test requires an active internet connection and thus might fail even when the code is correct. run `export MUREX_TEST_NO_HTTP=true` to skip this test") 21 22 p := lang.NewTestProcess() 23 24 _, dt, err := http(p, "https://api.github.com/repos/lmorg/murex/issues") 25 if err != nil { 26 t.Error(err.Error()) 27 } 28 29 if dt != types.Json { 30 t.Errorf("API not recognized as JSON: `%s`", dt) 31 } 32 }