grafana/pkg/components/renderer/renderer_test.go

35 lines
583 B
Go
Raw Normal View History

2014-10-07 03:31:54 +08:00
package renderer
import (
"io/ioutil"
2014-08-09 17:57:54 +08:00
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestPhantomRender(t *testing.T) {
2014-08-09 17:57:54 +08:00
Convey("Can render url", t, func() {
tempDir, _ := ioutil.TempDir("", "img")
2014-10-07 03:31:54 +08:00
png, err := RenderToPng("http://www.google.com")
2014-08-09 17:57:54 +08:00
So(err, ShouldBeNil)
So(exists(png), ShouldEqual, true)
//_, err = os.Stat(store.getFilePathForDashboard("hello"))
//So(err, ShouldBeNil)
})
}
2014-08-09 17:57:54 +08:00
func exists(path string) bool {
_, err := os.Stat(path)
if err == nil {
return true
}
if os.IsNotExist(err) {
return false
}
return false
}