2015-02-27 06:45:00 -06:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
2015-11-27 03:04:43 -06:00
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
2015-02-27 06:45:00 -06:00
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
2015-11-27 03:17:27 -06:00
|
|
|
"gopkg.in/ini.v1"
|
2015-02-27 06:45:00 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPluginScans(t *testing.T) {
|
|
|
|
|
|
|
|
Convey("When scaning for plugins", t, func() {
|
2015-11-27 03:17:27 -06:00
|
|
|
setting.StaticRootPath, _ = filepath.Abs("../../public/")
|
|
|
|
setting.Cfg = ini.Empty()
|
2015-11-27 03:04:43 -06:00
|
|
|
err := Init()
|
2015-02-27 06:45:00 -06:00
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
2015-02-28 04:38:44 -06:00
|
|
|
So(len(DataSources), ShouldBeGreaterThan, 1)
|
2016-01-08 13:57:58 -06:00
|
|
|
So(len(Panels), ShouldBeGreaterThan, 1)
|
2015-02-27 06:45:00 -06:00
|
|
|
})
|
2016-01-08 13:57:58 -06:00
|
|
|
|
|
|
|
Convey("When reading app plugin definition", t, func() {
|
|
|
|
setting.Cfg = ini.Empty()
|
|
|
|
sec, _ := setting.Cfg.NewSection("plugin.app-test")
|
|
|
|
sec.NewKey("path", "../../tests/app-plugin-json")
|
|
|
|
err := Init()
|
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
So(len(Apps), ShouldBeGreaterThan, 0)
|
2016-01-09 01:12:27 -06:00
|
|
|
So(Apps["app-example"].Info.Logos.Large, ShouldEqual, "public/plugins/app-example/img/logo_large.png")
|
2016-01-08 13:57:58 -06:00
|
|
|
})
|
|
|
|
|
2015-02-27 06:45:00 -06:00
|
|
|
}
|