EditMilestoneOption also use StateType (#350)
Merge branch 'master' into EditMilestone_also-use-StateType Merge branch 'master' into EditMilestone_also-use-StateType fix test Merge branch 'master' into EditMilestone_also-use-StateType EditMilestoneOption also use StateType Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/350 Reviewed-by: John Olheiser <john.olheiser@gmail.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
8829e1fe6f
commit
c5211db2e7
2 changed files with 5 additions and 4 deletions
|
@ -77,7 +77,7 @@ func (c *Client) CreateMilestone(owner, repo string, opt CreateMilestoneOption)
|
|||
type EditMilestoneOption struct {
|
||||
Title string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
State *string `json:"state"`
|
||||
State *StateType `json:"state"`
|
||||
Deadline *time.Time `json:"due_on"`
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ func TestMilestones(t *testing.T) {
|
|||
now := time.Now()
|
||||
future := time.Unix(1896134400, 0) //2030-02-01
|
||||
closed := "closed"
|
||||
sClosed := StateClosed
|
||||
|
||||
// CreateMilestone 4x
|
||||
m1, err := c.CreateMilestone(repo.Owner.UserName, repo.Name, CreateMilestoneOption{Title: "v1.0", Description: "First Version", Deadline: &now})
|
||||
|
@ -32,7 +33,7 @@ func TestMilestones(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
|
||||
// EditMilestone
|
||||
m1, err = c.EditMilestone(repo.Owner.UserName, repo.Name, m1.ID, EditMilestoneOption{Description: &closed, State: &closed})
|
||||
m1, err = c.EditMilestone(repo.Owner.UserName, repo.Name, m1.ID, EditMilestoneOption{Description: &closed, State: &sClosed})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// DeleteMilestone
|
||||
|
@ -42,10 +43,10 @@ func TestMilestones(t *testing.T) {
|
|||
ml, err := c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, ml, 2)
|
||||
ml, err = c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{State: "closed"})
|
||||
ml, err = c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{State: StateClosed})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, ml, 1)
|
||||
ml, err = c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{State: "all"})
|
||||
ml, err = c.ListRepoMilestones(repo.Owner.UserName, repo.Name, ListMilestoneOption{State: StateAll})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, ml, 3)
|
||||
|
||||
|
|
Loading…
Reference in a new issue