summaryrefslogtreecommitdiffstats
path: root/app/user_test.go
diff options
context:
space:
mode:
authorDaniel Schalla <daniel@schalla.me>2018-06-25 18:12:59 +0200
committerHarrison Healey <harrisonmhealey@gmail.com>2018-06-25 12:12:59 -0400
commitecefa6cdd1e7376046bbec82c1b47f7756fea646 (patch)
treed1cb2486e344c1bb93353020713b9eb2146a5b6f /app/user_test.go
parentfc158fce907b602bbde3babfadfd1a04d1dde31e (diff)
downloadchat-ecefa6cdd1e7376046bbec82c1b47f7756fea646.tar.gz
chat-ecefa6cdd1e7376046bbec82c1b47f7756fea646.tar.bz2
chat-ecefa6cdd1e7376046bbec82c1b47f7756fea646.zip
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
Diffstat (limited to 'app/user_test.go')
-rw-r--r--app/user_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/user_test.go b/app/user_test.go
index b557d296b..7952eaa1f 100644
--- a/app/user_test.go
+++ b/app/user_test.go
@@ -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")
+ }
+}