diff options
Diffstat (limited to 'services/issue/milestone_test.go')
-rw-r--r-- | services/issue/milestone_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/services/issue/milestone_test.go b/services/issue/milestone_test.go index 1c06572f8e..e75f64550c 100644 --- a/services/issue/milestone_test.go +++ b/services/issue/milestone_test.go @@ -24,6 +24,7 @@ func TestChangeMilestoneAssign(t *testing.T) { oldMilestoneID := issue.MilestoneID issue.MilestoneID = 2 + require.NoError(t, issue.LoadMilestone(db.DefaultContext)) require.NoError(t, ChangeMilestoneAssign(db.DefaultContext, issue, doer, oldMilestoneID)) unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{ IssueID: issue.ID, @@ -32,4 +33,11 @@ func TestChangeMilestoneAssign(t *testing.T) { OldMilestoneID: oldMilestoneID, }) unittest.CheckConsistencyFor(t, &issues_model.Milestone{}, &issues_model.Issue{}) + assert.NotNil(t, issue.Milestone) + + oldMilestoneID = issue.MilestoneID + issue.MilestoneID = 0 + require.NoError(t, ChangeMilestoneAssign(db.DefaultContext, issue, doer, oldMilestoneID)) + assert.EqualValues(t, 0, issue.MilestoneID) + assert.Nil(t, issue.Milestone) } |