mirror of https://github.com/grafana/grafana.git
				
				
				
			
		
			
				
	
	
		
			36 lines
		
	
	
		
			846 B
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			846 B
		
	
	
	
		
			Go
		
	
	
	
| package plugins
 | |
| 
 | |
| import (
 | |
| 	"path/filepath"
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/grafana/grafana/pkg/setting"
 | |
| 	. "github.com/smartystreets/goconvey/convey"
 | |
| 	"gopkg.in/ini.v1"
 | |
| )
 | |
| 
 | |
| func TestPluginScans(t *testing.T) {
 | |
| 
 | |
| 	Convey("When scaning for plugins", t, func() {
 | |
| 		setting.StaticRootPath, _ = filepath.Abs("../../public/")
 | |
| 		setting.Cfg = ini.Empty()
 | |
| 		err := Init()
 | |
| 
 | |
| 		So(err, ShouldBeNil)
 | |
| 		So(len(DataSources), ShouldBeGreaterThan, 1)
 | |
| 		So(len(Panels), ShouldBeGreaterThan, 1)
 | |
| 	})
 | |
| 
 | |
| 	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)
 | |
| 		So(Apps["app-test"].Info.Logos.Large, ShouldEqual, "plugins/app-exampl/img/logo_large.png")
 | |
| 	})
 | |
| 
 | |
| }
 |