Commit d5fa1297 authored by Ibrahim Serdar Acikgoz's avatar Ibrahim Serdar Acikgoz Committed by Miguel de la Cruz
Browse files

services/filestore: migrate s3store_test to testify (#12685)

* services/filestore: migrate s3store_test to testify

* services/filestore: s3_store_test.go polished
parent dc05e810
......@@ -7,26 +7,23 @@ import (
"testing"
"github.com/mattermost/mattermost-server/model"
"github.com/stretchr/testify/require"
)
func TestCheckMandatoryS3Fields(t *testing.T) {
cfg := model.FileSettings{}
err := CheckMandatoryS3Fields(&cfg)
if err == nil || err.Message != "api.admin.test_s3.missing_s3_bucket" {
t.Fatal("should've failed with missing s3 bucket")
}
require.NotNil(t, err)
require.Equal(t, err.Message, "api.admin.test_s3.missing_s3_bucket", "should've failed with missing s3 bucket")
cfg.AmazonS3Bucket = model.NewString("test-mm")
err = CheckMandatoryS3Fields(&cfg)
if err != nil {
t.Fatal("should've not failed")
}
require.Nil(t, err)
cfg.AmazonS3Endpoint = model.NewString("")
err = CheckMandatoryS3Fields(&cfg)
if err != nil || *cfg.AmazonS3Endpoint != "s3.amazonaws.com" {
t.Fatal("should've not failed because it should set the endpoint to the default")
}
require.Nil(t, err)
require.Equal(t, *cfg.AmazonS3Endpoint, "s3.amazonaws.com", "should've set the endpoint to the default")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment