2017-08-04 16:46:26 -05:00
|
|
|
package imguploader
|
|
|
|
|
|
|
|
import (
|
2017-09-15 08:46:41 -05:00
|
|
|
"context"
|
2017-08-04 16:46:26 -05:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
)
|
|
|
|
|
2017-08-06 10:04:38 -05:00
|
|
|
func TestUploadToGCS(t *testing.T) {
|
|
|
|
SkipConvey("[Integration test] for external_image_store.gcs", t, func() {
|
2018-04-30 09:21:04 -05:00
|
|
|
cfg := setting.NewCfg()
|
2019-10-10 02:06:55 -05:00
|
|
|
err := cfg.Load(&setting.CommandLineArgs{
|
2017-08-04 16:46:26 -05:00
|
|
|
HomePath: "../../../",
|
|
|
|
})
|
2019-10-10 02:06:55 -05:00
|
|
|
So(err, ShouldBeNil)
|
2017-08-04 16:46:26 -05:00
|
|
|
|
2017-08-06 10:04:38 -05:00
|
|
|
gcsUploader, _ := NewImageUploader()
|
2017-08-04 16:46:26 -05:00
|
|
|
|
2017-09-15 08:46:41 -05:00
|
|
|
path, err := gcsUploader.Upload(context.Background(), "../../../public/img/logo_transparent_400x.png")
|
2017-08-04 16:46:26 -05:00
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
So(path, ShouldNotEqual, "")
|
|
|
|
})
|
|
|
|
}
|