diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-02-27 23:25:28 +0900 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-02-27 09:25:28 -0500 |
commit | 71d010b7af3601b0690407af328ec2865e3a0efd (patch) | |
tree | cd8f6a3dce8846641e304d9396e8c098004049f5 /app | |
parent | 19b753467d37209f2227567637e60138d05dd405 (diff) | |
download | chat-71d010b7af3601b0690407af328ec2865e3a0efd.tar.gz chat-71d010b7af3601b0690407af328ec2865e3a0efd.tar.bz2 chat-71d010b7af3601b0690407af328ec2865e3a0efd.zip |
APIv4: GET /users/{user_id}/image (#5526)
Diffstat (limited to 'app')
-rw-r--r-- | app/user_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
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) { |