Extend Issue Struct (#258)
fix extend IssueTest add Repository to Issue struct Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/258 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
9373eb89a4
commit
1b11eb569b
2 changed files with 20 additions and 0 deletions
|
@ -41,6 +41,7 @@ type Issue struct {
|
||||||
Closed *time.Time `json:"closed_at"`
|
Closed *time.Time `json:"closed_at"`
|
||||||
Deadline *time.Time `json:"due_date"`
|
Deadline *time.Time `json:"due_date"`
|
||||||
PullRequest *PullRequestMeta `json:"pull_request"`
|
PullRequest *PullRequestMeta `json:"pull_request"`
|
||||||
|
Repository *Repository `json:"repository"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListIssueOption list issue options
|
// ListIssueOption list issue options
|
||||||
|
|
|
@ -18,6 +18,7 @@ func TestIssue(t *testing.T) {
|
||||||
c := newTestClient()
|
c := newTestClient()
|
||||||
|
|
||||||
createIssue(t, c)
|
createIssue(t, c)
|
||||||
|
editIssues(t, c)
|
||||||
listIssues(t, c)
|
listIssues(t, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +78,24 @@ func createIssue(t *testing.T, c *Client) {
|
||||||
createOne("", "you never know", nil, nil, mile.ID, nil, true, true)
|
createOne("", "you never know", nil, nil, mile.ID, nil, true, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func editIssues(t *testing.T, c *Client) {
|
||||||
|
log.Println("== TestEditIssues ==")
|
||||||
|
il, err := c.ListIssues(ListIssueOption{KeyWord: "soon"})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
issue, err := c.GetIssue(il[0].Poster.UserName, il[0].Repository.Name, il[0].Index)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
body := "123 test and go"
|
||||||
|
issueNew, err := c.EditIssue(issue.Poster.UserName, issue.Repository.Name, issue.Index, EditIssueOption{
|
||||||
|
Title: "Edited",
|
||||||
|
Body: &body,
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.EqualValues(t, issue.ID, issueNew.ID)
|
||||||
|
assert.EqualValues(t, body, issueNew.Body)
|
||||||
|
assert.EqualValues(t, "Edited", issueNew.Title)
|
||||||
|
}
|
||||||
|
|
||||||
func listIssues(t *testing.T, c *Client) {
|
func listIssues(t *testing.T, c *Client) {
|
||||||
log.Println("== TestListIssues ==")
|
log.Println("== TestListIssues ==")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue