You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
naza/pkg/nazahttp/http_test.go

20 lines
543 B
Go

package nazahttp_test
import (
"github.com/q191201771/naza/pkg/assert"
"github.com/q191201771/naza/pkg/nazahttp"
"testing"
)
func TestDownloadHttpFile(t *testing.T) {
n, err := nazahttp.DownloadHttpFile("http://pengrl.com", "/tmp/index.html", 10000)
assert.Equal(t, true, n > 0)
assert.Equal(t, nil, err)
n, err = nazahttp.DownloadHttpFile("http://127.0.0.1:12356", "/tmp/index.html", 10000)
assert.IsNotNil(t, err)
n, err = nazahttp.DownloadHttpFile("http://pengrl.com", "/notexist/index.html", 10000)
assert.IsNotNil(t, err)
}