mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 20:28:29 +00:00
Update go-github library
This commit is contained in:
66
vendor/github.com/google/go-github/github/repos_commits_test.go
generated
vendored
66
vendor/github.com/google/go-github/github/repos_commits_test.go
generated
vendored
@@ -10,12 +10,13 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestRepositoriesService_ListCommits(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
// given
|
||||
@@ -52,7 +53,7 @@ func TestRepositoriesService_ListCommits(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRepositoriesService_GetCommit(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -126,8 +127,65 @@ func TestRepositoriesService_GetCommit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoriesService_GetCommitRaw_diff(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
const rawStr = "@@diff content"
|
||||
|
||||
mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testHeader(t, r, "Accept", mediaTypeV3Diff)
|
||||
fmt.Fprint(w, rawStr)
|
||||
})
|
||||
|
||||
got, _, err := client.Repositories.GetCommitRaw(context.Background(), "o", "r", "s", RawOptions{Type: Diff})
|
||||
if err != nil {
|
||||
t.Fatalf("Repositories.GetCommitRaw returned error: %v", err)
|
||||
}
|
||||
want := rawStr
|
||||
if got != want {
|
||||
t.Errorf("Repositories.GetCommitRaw returned %s want %s", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoriesService_GetCommitRaw_patch(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
const rawStr = "@@patch content"
|
||||
|
||||
mux.HandleFunc("/repos/o/r/commits/s", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testHeader(t, r, "Accept", mediaTypeV3Patch)
|
||||
fmt.Fprint(w, rawStr)
|
||||
})
|
||||
|
||||
got, _, err := client.Repositories.GetCommitRaw(context.Background(), "o", "r", "s", RawOptions{Type: Patch})
|
||||
if err != nil {
|
||||
t.Fatalf("Repositories.GetCommitRaw returned error: %v", err)
|
||||
}
|
||||
want := rawStr
|
||||
if got != want {
|
||||
t.Errorf("Repositories.GetCommitRaw returned %s want %s", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoriesService_GetCommitRaw_invalid(t *testing.T) {
|
||||
client, _, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
_, _, err := client.Repositories.GetCommitRaw(context.Background(), "o", "r", "s", RawOptions{100})
|
||||
if err == nil {
|
||||
t.Fatal("Repositories.GetCommitRaw should return error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "unsupported raw type") {
|
||||
t.Error("Repositories.GetCommitRaw should return unsupported raw type error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepositoriesService_GetCommitSHA1(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
const sha1 = "01234abcde"
|
||||
|
||||
@@ -168,7 +226,7 @@ func TestRepositoriesService_GetCommitSHA1(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRepositoriesService_CompareCommits(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/compare/b...h", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user