mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-05 00:48:30 +00:00
Update go-github library
This commit is contained in:
126
vendor/github.com/google/go-github/github/reactions_test.go
generated
vendored
126
vendor/github.com/google/go-github/github/reactions_test.go
generated
vendored
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestReactionsService_ListCommentReactions(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -28,13 +28,14 @@ func TestReactionsService_ListCommentReactions(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("ListCommentReactions returned error: %v", err)
|
||||
}
|
||||
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListCommentReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_CreateCommentReaction(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -49,14 +50,14 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("CreateCommentReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreateCommentReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_ListIssueReactions(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -71,13 +72,14 @@ func TestReactionsService_ListIssueReactions(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("ListIssueReactions returned error: %v", err)
|
||||
}
|
||||
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListIssueReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_CreateIssueReaction(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/issues/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -92,14 +94,14 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("CreateIssueReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreateIssueReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_ListIssueCommentReactions(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -114,13 +116,14 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("ListIssueCommentReactions returned error: %v", err)
|
||||
}
|
||||
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListIssueCommentReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_CreateIssueCommentReaction(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/issues/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -135,14 +138,14 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("CreateIssueCommentReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreateIssueCommentReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -157,13 +160,14 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("ListPullRequestCommentReactions returned error: %v", err)
|
||||
}
|
||||
if want := []*Reaction{{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}}; !reflect.DeepEqual(got, want) {
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListPullRequestCommentReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/repos/o/r/pulls/comments/1/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -178,14 +182,102 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("CreatePullRequestCommentReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int(1), User: &User{Login: String("l"), ID: Int(2)}, Content: String("+1")}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreatePullRequestCommentReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||
})
|
||||
|
||||
got, _, err := client.Reactions.ListTeamDiscussionReactions(context.Background(), 1, 2, nil)
|
||||
if err != nil {
|
||||
t.Errorf("ListTeamDiscussionReactions returned error: %v", err)
|
||||
}
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListTeamDiscussionReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/teams/1/discussions/2/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "POST")
|
||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||
})
|
||||
|
||||
got, _, err := client.Reactions.CreateTeamDiscussionReaction(context.Background(), 1, 2, "+1")
|
||||
if err != nil {
|
||||
t.Errorf("CreateTeamDiscussionReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreateTeamDiscussionReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`))
|
||||
})
|
||||
|
||||
got, _, err := client.Reactions.ListTeamDiscussionCommentReactions(context.Background(), 1, 2, 3, nil)
|
||||
if err != nil {
|
||||
t.Errorf("ListTeamDiscussionCommentReactions returned error: %v", err)
|
||||
}
|
||||
want := []*Reaction{{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListTeamDiscussionCommentReactions = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) {
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/teams/1/discussions/2/comments/3/reactions", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "POST")
|
||||
testHeader(t, r, "Accept", mediaTypeReactionsPreview)
|
||||
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`))
|
||||
})
|
||||
|
||||
got, _, err := client.Reactions.CreateTeamDiscussionCommentReaction(context.Background(), 1, 2, 3, "+1")
|
||||
if err != nil {
|
||||
t.Errorf("CreateTeamDiscussionCommentReaction returned error: %v", err)
|
||||
}
|
||||
want := &Reaction{ID: Int64(1), User: &User{Login: String("l"), ID: Int64(2)}, Content: String("+1")}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("CreateTeamDiscussionCommentReaction = %+v, want %+v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReactionsService_DeleteReaction(t *testing.T) {
|
||||
setup()
|
||||
client, mux, _, teardown := setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/reactions/1", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user