summaryrefslogtreecommitdiffstats
path: root/models/issue_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issue_test.go')
-rw-r--r--models/issue_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/models/issue_test.go b/models/issue_test.go
index d135b534df..8a8ccce459 100644
--- a/models/issue_test.go
+++ b/models/issue_test.go
@@ -7,6 +7,7 @@ package models
import (
"sort"
"testing"
+ "time"
"github.com/stretchr/testify/assert"
)
@@ -146,3 +147,23 @@ func TestIssue_ClearLabels(t *testing.T) {
AssertNotExistsBean(t, &IssueLabel{IssueID: test.issueID})
}
}
+
+func TestUpdateIssueCols(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+ issue := AssertExistsAndLoadBean(t, &Issue{}).(*Issue)
+
+ const newTitle = "New Title for unit test"
+ issue.Title = newTitle
+
+ prevContent := issue.Content
+ issue.Content = "This should have no effect"
+
+ now := time.Now().Unix()
+ assert.NoError(t, UpdateIssueCols(issue, "name"))
+ then := time.Now().Unix()
+
+ updatedIssue := AssertExistsAndLoadBean(t, &Issue{ID: issue.ID}).(*Issue)
+ assert.EqualValues(t, newTitle, updatedIssue.Title)
+ assert.EqualValues(t, prevContent, updatedIssue.Content)
+ AssertInt64InRange(t, now, then, updatedIssue.UpdatedUnix)
+}