forked from shuheiktgw/go-travis
/
organizations_integration_test.go
50 lines (38 loc) · 1.3 KB
/
organizations_integration_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
50
// Copyright (c) 2015 Ableton AG, Berlin. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build integration
package travis
import (
"context"
"net/http"
"testing"
)
const integrationOrgId = 111
func TestOrganizationsService_Integration_Find(t *testing.T) {
opt := OrganizationOption{Include: []string{"organization.repositories"}}
org, res, err := integrationClient.Organizations.Find(context.TODO(), integrationOrgId, &opt)
if err != nil {
t.Fatalf("unexpected error occured: %s", err)
}
if res.StatusCode != http.StatusOK {
t.Fatalf("invalid http status: %s", res.Status)
}
if got, want := *org.Id, uint(integrationOrgId); got != want {
t.Fatalf("invalid org id: want: %d, got: %d", want, got)
}
if r := org.Repositories[0]; !r.IsStandard() {
t.Fatal("repository is not in a standard representation")
}
}
func TestOrganizationsService_Integration_List(t *testing.T) {
opt := OrganizationsOption{Limit: 50, Offset: 50, SortBy: "id", Include: []string{"organization.repositories"}}
_, res, err := integrationClient.Organizations.List(context.TODO(), &opt)
if err != nil {
t.Fatalf("unexpected error occured: %s", err)
}
if res.StatusCode != http.StatusOK {
t.Fatalf("invalid http status: %s", res.Status)
}
}