services/filestore: migrate s3store_test to testify (#12685)
* services/filestore: migrate s3store_test to testify * services/filestore: s3_store_test.go polished
Этот коммит содержится в:
коммит произвёл
Miguel de la Cruz
родитель
dc05e81012
Коммит
d5fa1297a9
@@ -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")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user