renderer_test.go 583 B

12345678910111213141516171819202122232425262728293031323334
  1. package renderer
  2. import (
  3. "io/ioutil"
  4. "os"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestPhantomRender(t *testing.T) {
  9. Convey("Can render url", t, func() {
  10. tempDir, _ := ioutil.TempDir("", "img")
  11. png, err := RenderToPng("http://www.google.com")
  12. So(err, ShouldBeNil)
  13. So(exists(png), ShouldEqual, true)
  14. //_, err = os.Stat(store.getFilePathForDashboard("hello"))
  15. //So(err, ShouldBeNil)
  16. })
  17. }
  18. func exists(path string) bool {
  19. _, err := os.Stat(path)
  20. if err == nil {
  21. return true
  22. }
  23. if os.IsNotExist(err) {
  24. return false
  25. }
  26. return false
  27. }