diff options
author | 6543 <6543@obermui.de> | 2020-04-29 01:28:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 19:28:56 -0400 |
commit | 6b6f20b6d43b6263320ee872799373f33a751304 (patch) | |
tree | 584770b71c3482138a709e42e055f6c8c6558b90 /models/issue_label_test.go | |
parent | 4563eb873d3d46953aeb43a1cebf3389906b0b88 (diff) | |
download | gitea-6b6f20b6d43b6263320ee872799373f33a751304.tar.gz gitea-6b6f20b6d43b6263320ee872799373f33a751304.zip |
BugFix: updateLabel can updated not allowed fields #11242 (#11242)
Diffstat (limited to 'models/issue_label_test.go')
-rw-r--r-- | models/issue_label_test.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/models/issue_label_test.go b/models/issue_label_test.go index 8afba779e0..982f6b165a 100644 --- a/models/issue_label_test.go +++ b/models/issue_label_test.go @@ -252,9 +252,16 @@ func TestGetLabelsByIssueID(t *testing.T) { func TestUpdateLabel(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) label := AssertExistsAndLoadBean(t, &Label{ID: 1}).(*Label) - label.Color = "#ffff00" - label.Name = "newLabelName" - assert.NoError(t, UpdateLabel(label)) + // make sure update wont overwrite it + update := &Label{ + ID: label.ID, + Color: "#ffff00", + Name: "newLabelName", + Description: label.Description, + } + label.Color = update.Color + label.Name = update.Name + assert.NoError(t, UpdateLabel(update)) newLabel := AssertExistsAndLoadBean(t, &Label{ID: 1}).(*Label) assert.Equal(t, *label, *newLabel) CheckConsistencyFor(t, &Label{}, &Repository{}) |