From 71d010b7af3601b0690407af328ec2865e3a0efd Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Mon, 27 Feb 2017 23:25:28 +0900 Subject: APIv4: GET /users/{user_id}/image (#5526) --- app/user_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app/user_test.go') diff --git a/app/user_test.go b/app/user_test.go index 177f5a638..8979af7d7 100644 --- a/app/user_test.go +++ b/app/user_test.go @@ -5,6 +5,8 @@ package app import ( "bytes" + "image" + "image/color" "encoding/json" "math/rand" "strings" @@ -89,7 +91,27 @@ func TestCreateOAuthUser(t *testing.T) { if err == nil { t.Fatal("should have failed - user creation disabled") } +} + +func TestCreateProfileImage(t *testing.T) { + utils.LoadConfig("config.json") + + 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 img.At(1, 1) != colorful { + t.Fatal("Failed to create correct color") + } } func TestUpdateOAuthUserAttrs(t *testing.T) { -- cgit v1.2.3-1-g7c22