summaryrefslogtreecommitdiffstats
path: root/app/file_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-09-12 09:19:52 -0500
committerGitHub <noreply@github.com>2017-09-12 09:19:52 -0500
commitb066b6df138e88e75cb40f1ec3e58fbd13e61909 (patch)
tree7ee0e8c935cd3bbafd15d0d07d8900af8b82a4e0 /app/file_test.go
parent674a606bd00b276d0a05b3b29a3d5f5e5e7f8206 (diff)
downloadchat-b066b6df138e88e75cb40f1ec3e58fbd13e61909.tar.gz
chat-b066b6df138e88e75cb40f1ec3e58fbd13e61909.tar.bz2
chat-b066b6df138e88e75cb40f1ec3e58fbd13e61909.zip
Remove global app references (#7433)
* remove global app references * test fix * fix api4 test compilation
Diffstat (limited to 'app/file_test.go')
-rw-r--r--app/file_test.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/app/file_test.go b/app/file_test.go
index e921eb4d9..62511ceea 100644
--- a/app/file_test.go
+++ b/app/file_test.go
@@ -36,8 +36,7 @@ func TestGeneratePublicLinkHash(t *testing.T) {
}
func TestDoUploadFile(t *testing.T) {
- a := Global()
- a.Setup()
+ th := Setup()
teamId := model.NewId()
channelId := model.NewId()
@@ -45,12 +44,12 @@ func TestDoUploadFile(t *testing.T) {
filename := "test"
data := []byte("abcd")
- info1, err := a.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
+ info1, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
if err != nil {
t.Fatal(err)
} else {
defer func() {
- <-a.Srv.Store.FileInfo().PermanentDelete(info1.Id)
+ <-th.App.Srv.Store.FileInfo().PermanentDelete(info1.Id)
utils.RemoveFile(info1.Path)
}()
}
@@ -59,12 +58,12 @@ func TestDoUploadFile(t *testing.T) {
t.Fatal("stored file at incorrect path", info1.Path)
}
- info2, err := a.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
+ info2, err := th.App.DoUploadFile(time.Date(2007, 2, 4, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
if err != nil {
t.Fatal(err)
} else {
defer func() {
- <-a.Srv.Store.FileInfo().PermanentDelete(info2.Id)
+ <-th.App.Srv.Store.FileInfo().PermanentDelete(info2.Id)
utils.RemoveFile(info2.Path)
}()
}
@@ -73,12 +72,12 @@ func TestDoUploadFile(t *testing.T) {
t.Fatal("stored file at incorrect path", info2.Path)
}
- info3, err := a.DoUploadFile(time.Date(2008, 3, 5, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
+ info3, err := th.App.DoUploadFile(time.Date(2008, 3, 5, 1, 2, 3, 4, time.Local), teamId, channelId, userId, filename, data)
if err != nil {
t.Fatal(err)
} else {
defer func() {
- <-a.Srv.Store.FileInfo().PermanentDelete(info3.Id)
+ <-th.App.Srv.Store.FileInfo().PermanentDelete(info3.Id)
utils.RemoveFile(info3.Path)
}()
}