forked from justinhennessy/quayd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quayd_test.go
47 lines (36 loc) · 953 Bytes
/
quayd_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
package quayd
import (
"testing"
"github.com/ejholmes/go-github/github"
)
// TODO Make this work.
func testGitHubStatusesRepository(t *testing.T) {
repo := "ejholmes/docker-statsd"
g := github.NewClient(nil)
r := &GitHubStatusesRepository{RepositoriesService: g.Repositories}
s := &Status{Repo: repo, Ref: "6607c19", State: "pending", Context: "test"}
if err := r.Create(s); err != nil {
t.Fatal(err)
}
}
// TODO Don't make network requests.
func TestGitHubCommitResolver(t *testing.T) {
repo := "ejholmes/docker-statsd"
tests := []struct {
in string
out string
}{
{"6607c19", "6607c19d3fd492ec53439f4104b39e4c62ece179"},
}
for _, tt := range tests {
g := github.NewClient(nil)
r := &GitHubCommitResolver{RepositoriesService: g.Repositories}
sha, err := r.Resolve(repo, tt.in)
if err != nil {
t.Fatal(err)
}
if got, want := sha, tt.out; got != want {
t.Fatalf("Sha => %s; want %s", got, want)
}
}
}