summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-19 11:34:48 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-19 11:34:48 -0400
commite79f5baa282e554a739595a43e18c4bcead014ef (patch)
tree6bfec7993e3fbeb43e80bfa8e84f73c8283d033d /api
parent9c780c2de5fc70bd8d31274a4389d69e2c16e384 (diff)
downloadchat-e79f5baa282e554a739595a43e18c4bcead014ef.tar.gz
chat-e79f5baa282e554a739595a43e18c4bcead014ef.tar.bz2
chat-e79f5baa282e554a739595a43e18c4bcead014ef.zip
update unit tests for new createProfileImage func
Diffstat (limited to 'api')
-rw-r--r--api/user_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/api/user_test.go b/api/user_test.go
index 4d5d2b3f0..92ab216aa 100644
--- a/api/user_test.go
+++ b/api/user_test.go
@@ -10,6 +10,7 @@ import (
"github.com/goamz/goamz/s3"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
+ "image"
"image/color"
"io"
"mime/multipart"
@@ -324,14 +325,20 @@ func TestGetAudits(t *testing.T) {
func TestUserCreateImage(t *testing.T) {
Setup()
- i := createProfileImage("Corey Hulen", "eo1zkdr96pdj98pjmq8zy35wba")
- if i == nil {
- t.Fatal("Failed to gen image")
+ b, err := createProfileImage("Corey Hulen", "eo1zkdr96pdj98pjmq8zy35wba")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ rdr := bytes.NewReader(b)
+ img, _, err2 := image.Decode(rdr)
+ if err2 != nil {
+ t.Fatal(err)
}
colorful := color.RGBA{116, 49, 196, 255}
- if i.RGBAAt(1, 1) != colorful {
+ if img.At(1, 1) != colorful {
t.Fatal("Failed to create correct color")
}