forked from Ableton/go-travis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
repositories_integration_test.go
84 lines (65 loc) · 1.91 KB
/
repositories_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// 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 "testing"
func TestRepositoriesService_Find_without_options(t *testing.T) {
t.Parallel()
_, _, err := integrationClient.Repositories.Find(nil)
ok(t, err)
}
func TestRepositoriesService_Find_with_options(t *testing.T) {
t.Parallel()
opt := &RepositoryListOptions{Slug: integrationRepo}
repositories, _, err := integrationClient.Repositories.Find(opt)
ok(t, err)
assert(
t,
len(repositories) == 1,
"Repositories.Find returned no repositories; expected 1",
)
assert(
t,
repositories[0].Slug == integrationRepo,
"Repositories.Find returned a repository with slug %s; expected %s", repositories[0].Slug, integrationRepo,
)
}
func TestRepositoriesService_GetFromSlug(t *testing.T) {
t.Parallel()
repository, _, err := integrationClient.Repositories.GetFromSlug(integrationRepo)
ok(t, err)
assert(
t,
repository != nil,
"Repositories.GetFromSlug returned nil repository",
)
assert(
t,
repository.Slug == integrationRepo,
"Repositories.GetFromSlug returned a repository with slug %s; expected %s", repository.Slug, integrationRepo,
)
}
func TestRepositoriesService_Get(t *testing.T) {
t.Parallel()
repoFromSlug, _, err := integrationClient.Repositories.GetFromSlug(integrationRepo)
repositoryId := repoFromSlug.Id
repository, _, err := integrationClient.Repositories.Get(repositoryId)
ok(t, err)
assert(
t,
repository != nil,
"Repositories.Get returned nil repository",
)
assert(
t,
repository.Id == repositoryId,
"Repositories.Get returned a repository with Id %d; expected %d", repository.Id, repositoryId,
)
assert(
t,
repository.Slug == integrationRepo,
"Repositories.Get returned a repository with slug %s; expected %s", repository.Slug, integrationRepo,
)
}