summaryrefslogtreecommitdiffstats
path: root/api/user_test.go
diff options
context:
space:
mode:
authorHarshavardhana <harsha@minio.io>2016-10-26 05:21:07 -0700
committerChristopher Speller <crspeller@gmail.com>2016-10-26 08:21:07 -0400
commitf02620b291b988848392c455a7719699f6b5c00f (patch)
tree695e07607e86b000b9fe78e77df7f33673f1a755 /api/user_test.go
parentb354d25d3731b53613489d95cfa4c946cf8e0888 (diff)
downloadchat-f02620b291b988848392c455a7719699f6b5c00f.tar.gz
chat-f02620b291b988848392c455a7719699f6b5c00f.tar.bz2
chat-f02620b291b988848392c455a7719699f6b5c00f.zip
Moving away from goamz to use minio-go instead. (#4193)
minio-go does fully managed way of handling S3 API requests - Automatic bucket location management across all s3 regions. - Transparently upload large files in multipart if file 64MB or larger. - Right GetObject() API provides compatibility with io.ReadWriteSeeker interface. - Various other APIs including bulk deletes, server side object copy, bucket policies and bucket notifications. Fixes #4182
Diffstat (limited to 'api/user_test.go')
-rw-r--r--api/user_test.go41
1 files changed, 22 insertions, 19 deletions
diff --git a/api/user_test.go b/api/user_test.go
index 3b6fcb1fb..57f4729da 100644
--- a/api/user_test.go
+++ b/api/user_test.go
@@ -16,12 +16,11 @@ import (
"testing"
"time"
- "github.com/goamz/goamz/aws"
- "github.com/goamz/goamz/s3"
-
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/store"
"github.com/mattermost/platform/utils"
+
+ s3 "github.com/minio/minio-go"
)
func TestCreateUser(t *testing.T) {
@@ -674,14 +673,16 @@ func TestUserCreateImage(t *testing.T) {
Client.DoApiGet("/users/"+user.Id+"/image", "", "")
if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
- var auth aws.Auth
- auth.AccessKey = utils.Cfg.FileSettings.AmazonS3AccessKeyId
- auth.SecretKey = utils.Cfg.FileSettings.AmazonS3SecretAccessKey
-
- s := s3.New(auth, aws.Regions[utils.Cfg.FileSettings.AmazonS3Region])
- bucket := s.Bucket(utils.Cfg.FileSettings.AmazonS3Bucket)
-
- if err := bucket.Del("/users/" + user.Id + "/profile.png"); err != nil {
+ endpoint := utils.Cfg.FileSettings.AmazonS3Endpoint
+ accessKey := utils.Cfg.FileSettings.AmazonS3AccessKeyId
+ secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
+ secure := *utils.Cfg.FileSettings.AmazonS3SSL
+ s3Clnt, err := s3.New(endpoint, accessKey, secretKey, secure)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bucket := utils.Cfg.FileSettings.AmazonS3Bucket
+ if err = s3Clnt.RemoveObject(bucket, "/users/"+user.Id+"/profile.png"); err != nil {
t.Fatal(err)
}
} else {
@@ -774,14 +775,16 @@ func TestUserUploadProfileImage(t *testing.T) {
Client.DoApiGet("/users/"+user.Id+"/image", "", "")
if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
- var auth aws.Auth
- auth.AccessKey = utils.Cfg.FileSettings.AmazonS3AccessKeyId
- auth.SecretKey = utils.Cfg.FileSettings.AmazonS3SecretAccessKey
-
- s := s3.New(auth, aws.Regions[utils.Cfg.FileSettings.AmazonS3Region])
- bucket := s.Bucket(utils.Cfg.FileSettings.AmazonS3Bucket)
-
- if err := bucket.Del("users/" + user.Id + "/profile.png"); err != nil {
+ endpoint := utils.Cfg.FileSettings.AmazonS3Endpoint
+ accessKey := utils.Cfg.FileSettings.AmazonS3AccessKeyId
+ secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
+ secure := *utils.Cfg.FileSettings.AmazonS3SSL
+ s3Clnt, err := s3.New(endpoint, accessKey, secretKey, secure)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bucket := utils.Cfg.FileSettings.AmazonS3Bucket
+ if err = s3Clnt.RemoveObject(bucket, "/users/"+user.Id+"/profile.png"); err != nil {
t.Fatal(err)
}
} else {