BugFix: updateLabel can updated not allowed fields #11242 (#11242)

This commit is contained in:
6543
2020-04-29 01:28:56 +02:00
committed by GitHub
parent 4563eb873d
commit 6b6f20b6d4
3 changed files with 16 additions and 9 deletions

View File

@ -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{})