-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile_image_test.go
49 lines (37 loc) · 1.17 KB
/
profile_image_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package dev
import (
"os"
"testing"
)
func TestGetProfileImage(t *testing.T) {
c, err := NewTestClient()
if err != nil {
t.Errorf("Failed to create TestClient: %s", err.Error())
}
t.Run("user profile_image", func(t *testing.T) {
username := os.Getenv("TEST_USERNAME")
image, err := c.GetProfileImage(username)
if err != nil {
t.Errorf("Error fetching profile image: %s", err.Error())
}
if image.TypeOf != "profile_image" {
t.Errorf("Expected 'type_of' field to be 'profile_image', instead got '%s'", image.TypeOf)
}
if image.ImageOf != "user" {
t.Errorf("Expected 'image_of' field to be 'user', instead got '%s'", image.ImageOf)
}
})
t.Run("organization profile_image", func(t *testing.T) {
orgname := os.Getenv("TEST_ORGANIZATION_USERNAME")
image, err := c.GetProfileImage(orgname)
if err != nil {
t.Errorf("Error fetching profile image: %s", err.Error())
}
if image.TypeOf != "profile_image" {
t.Errorf("Expected 'type_of' field to be 'profile_image', instead got '%s'", image.TypeOf)
}
if image.ImageOf != "organization" {
t.Errorf("Expected 'image_of' field to be 'organization', instead got '%s'", image.ImageOf)
}
})
}