diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-05-04 15:45:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-04 15:45:19 -0400 |
commit | 49481caf6db89b0853626ac52ab5f786a6887179 (patch) | |
tree | 128991892f16d7830097c217db689410a002eb73 /api/file_test.go | |
parent | 44a8f76d993cdd97785cab7fd55ad9f07c3c757a (diff) | |
download | chat-49481caf6db89b0853626ac52ab5f786a6887179.tar.gz chat-49481caf6db89b0853626ac52ab5f786a6887179.tar.bz2 chat-49481caf6db89b0853626ac52ab5f786a6887179.zip |
PLT-6262 Add config setting to disable file attachments (#6301)
* Add config setting to disable file attachments
* Add unit tests
* Updating UI for no attachments (#6312)
* Update UI text on file upload System Console setting (#6313)
* Update storage_settings.jsx
* Update en.json
Diffstat (limited to 'api/file_test.go')
-rw-r--r-- | api/file_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/api/file_test.go b/api/file_test.go index 1e65c33e8..40534d724 100644 --- a/api/file_test.go +++ b/api/file_test.go @@ -99,6 +99,18 @@ func TestUploadFile(t *testing.T) { t.Fatalf("file preview should've been saved in %v", expectedPreviewPath) } + enableFileAttachments := *utils.Cfg.FileSettings.EnableFileAttachments + defer func() { + *utils.Cfg.FileSettings.EnableFileAttachments = enableFileAttachments + }() + *utils.Cfg.FileSettings.EnableFileAttachments = false + + if data, err := readTestFile("test.png"); err != nil { + t.Fatal(err) + } else if _, err = Client.UploadPostAttachment(data, channel.Id, "test.png"); err == nil { + t.Fatal("should have errored") + } + // Wait a bit for files to ready time.Sleep(2 * time.Second) |