Implementation of File Exists Function; Delete FileInfos upon Permanent User Delete (#8958)

Check if file was deleted on FS

Warning message if file couldnt be removed
Этот коммит содержится в:
Daniel Schalla
2018-06-25 18:12:59 +02:00
коммит произвёл Harrison Healey
родитель fc158fce90
Коммит ecefa6cdd1
11 изменённых файлов: 270 добавлений и 0 удалений

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

@@ -480,3 +480,47 @@ func TestCreateUserWithToken(t *testing.T) {
}
})
}
func TestPermanentDeleteUser(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
b := []byte("testimage")
finfo, err := th.App.DoUploadFile(time.Now(), th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, "testfile.txt", b)
if err != nil {
t.Log(err)
t.Fatal("Unable to upload file")
}
err = th.App.PermanentDeleteUser(th.BasicUser)
if err != nil {
t.Log(err)
t.Fatal("Unable to delete user")
}
res, err := th.App.FileExists(finfo.Path)
if err != nil {
t.Log(err)
t.Fatal("Unable to check whether file exists")
}
if res {
t.Log(err)
t.Fatal("File was not deleted on FS")
}
finfo, err = th.App.GetFileInfo(finfo.Id)
if finfo != nil {
t.Log(err)
t.Fatal("Unable to find finfo")
}
if err == nil {
t.Log(err)
t.Fatal("GetFileInfo after DeleteUser is nil")
}
}