Пример #1
0
func TestCollectIssues(t *testing.T) {
	fixtures.Setup()
	fixtures.SetupMux(t, "issues")
	defer fixtures.TearDown()

	r := github.NewGitHubRepositoryWithClient("docker", "docker", fixtures.Client)
	items := collectOpenedIssues(r)

	// 1 global counter + 4 issues + 4 labels
	if len(items) != 9 {
		t.Fatalf("Expected 8 metrics but got %d\n", len(items))
	}
}
Пример #2
0
func TestAllPullRequests(t *testing.T) {
	fixtures.Setup()
	fixtures.SetupMux(t, "pulls")
	defer fixtures.TearDown()

	r := NewGitHubRepositoryWithClient("docker", "docker", fixtures.Client)
	prs, err := r.PullRequests("open", "updated")
	if err != nil {
		t.Fatal(err)
	}

	if len(prs) != 4 {
		t.Fatalf("Expected 4 prs but it was %d\n", len(prs))
	}
}