Add plugin API for UploadFile method (#9684)

* Add plugin API for UploadFile method

* Add minimum server version documentation to plugin API UploadFile function

* Reorganize some imports
Этот коммит содержится в:
Christian Claus
2018-11-07 21:24:54 +01:00
коммит произвёл Hanzei
родитель 6d4421d18a
Коммит 93e581d642
7 изменённых файлов: 109 добавлений и 1 удалений

Просмотреть файл

@@ -107,6 +107,30 @@ func TestDoUploadFile(t *testing.T) {
}
}
func TestUploadFile(t *testing.T) {
th := Setup()
defer th.TearDown()
channelId := model.NewId()
filename := "test"
data := []byte("abcd")
info1, err := th.App.UploadFile(data, channelId, filename)
if err != nil {
t.Fatal(err)
} else {
defer func() {
<-th.App.Srv.Store.FileInfo().PermanentDelete(info1.Id)
th.App.RemoveFile(info1.Path)
}()
}
if info1.Path != fmt.Sprintf("%v/teams/noteam/channels/%v/users/nouser/%v/%v",
time.Now().Format("20060102"), channelId, info1.Id, filename) {
t.Fatal("stored file at incorrect path", info1.Path)
}
}
func TestGetInfoForFilename(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()