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