Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type IssueRequest struct {
StateReason *string `json:"state_reason,omitempty"`
Milestone *int `json:"milestone,omitempty"`
Assignees *[]string `json:"assignees,omitempty"`
Type *string `json:"type,omitempty"`
}

// IssueListOptions specifies the optional parameters to the IssuesService.List
Expand Down
16 changes: 11 additions & 5 deletions github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestIssuesService_Edit(t *testing.T) {
t.Parallel()
client, mux, _ := setup(t)

input := &IssueRequest{Title: Ptr("t")}
input := &IssueRequest{Title: Ptr("t"), Type: Ptr("bug")}

mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
v := new(IssueRequest)
Expand All @@ -325,7 +325,7 @@ func TestIssuesService_Edit(t *testing.T) {
t.Errorf("Request body = %+v, want %+v", v, input)
}

fmt.Fprint(w, `{"number":1}`)
fmt.Fprint(w, `{"number":1, "type": {"name": "bug"}}`)
})

ctx := context.Background()
Expand All @@ -334,7 +334,7 @@ func TestIssuesService_Edit(t *testing.T) {
t.Errorf("Issues.Edit returned error: %v", err)
}

want := &Issue{Number: Ptr(1)}
want := &Issue{Number: Ptr(1), Type: &IssueType{Name: Ptr("bug")}}
if !cmp.Equal(issue, want) {
t.Errorf("Issues.Edit returned %+v, want %+v", issue, want)
}
Expand Down Expand Up @@ -529,6 +529,7 @@ func TestIssueRequest_Marshal(t *testing.T) {
State: Ptr("url"),
Milestone: Ptr(1),
Assignees: &[]string{"a"},
Type: Ptr("issue_type"),
}

want := `{
Expand All @@ -542,7 +543,8 @@ func TestIssueRequest_Marshal(t *testing.T) {
"milestone": 1,
"assignees": [
"a"
]
],
"type": "issue_type"
}`

testJSONMarshal(t, u, want)
Expand Down Expand Up @@ -582,6 +584,7 @@ func TestIssue_Marshal(t *testing.T) {
NodeID: Ptr("nid"),
TextMatches: []*TextMatch{{ObjectURL: Ptr("ourl")}},
ActiveLockReason: Ptr("alr"),
Type: &IssueType{Name: Ptr("bug")},
}

want := `{
Expand Down Expand Up @@ -639,7 +642,10 @@ func TestIssue_Marshal(t *testing.T) {
"object_url": "ourl"
}
],
"active_lock_reason": "alr"
"active_lock_reason": "alr",
"type": {
"name": "bug"
}
}`

testJSONMarshal(t, u, want)
Expand Down
Loading