-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorganizations_test.go
More file actions
50 lines (42 loc) · 1.05 KB
/
organizations_test.go
File metadata and controls
50 lines (42 loc) · 1.05 KB
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
50
package scaleway
import (
"fmt"
"net/http"
"path/filepath"
"reflect"
"testing"
)
func TestOrganizationService_List(t *testing.T) {
setup()
defer teardown()
client.AuthToken = "654c95b0-2cf5-41a3-b3cc-733ffba4b4b7"
data := testOpenFixture(t, filepath.Join(fixtureDir, "organizations_list.json"))
mux.HandleFunc("/organizations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
w.Header().Add("Content-Type", contentType)
fmt.Fprint(w, string(data))
})
org, _, err := client.Organizations.List()
if err != nil {
t.Errorf("Organizations.List returned error: %v", err)
}
want := []*Organization{
{
ID: "000a115d-2852-4b0a-9ce8-47f1134ba95a",
Name: "jsnow@got.com",
Users: []*User{
{
Email: "jsnow@got.com",
Firstname: "John",
Fullname: "John Snow",
ID: "59a98700-8622-4495-a11a-e1efbfac5972",
Lastname: "Snow",
SSHPubKeys: []string{},
},
},
},
}
if !reflect.DeepEqual(org, want) {
t.Errorf("Organization.List returned %+v\n, want %+v", org, want)
}
}