summaryrefslogtreecommitdiffstats
path: root/models/issue_label_test.go
diff options
context:
space:
mode:
authorClar Fon <usr@ltdk.xyz>2022-02-07 16:21:02 -0500
committerGitHub <noreply@github.com>2022-02-07 21:21:02 +0000
commit9911b66aea076347cfb271b12c90bc31e4e5b5f8 (patch)
tree5f979a4f62479e6f78fdb8653bc18df9c77b7136 /models/issue_label_test.go
parent3a91f845e81aae386afb0210f3a66b88109e99a2 (diff)
downloadgitea-9911b66aea076347cfb271b12c90bc31e4e5b5f8.tar.gz
gitea-9911b66aea076347cfb271b12c90bc31e4e5b5f8.zip
Be more lenient with label colors (#17752)
Accept 12-bit color specifications.
Diffstat (limited to 'models/issue_label_test.go')
-rw-r--r--models/issue_label_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/models/issue_label_test.go b/models/issue_label_test.go
index 887f7f1425..68281dd7ad 100644
--- a/models/issue_label_test.go
+++ b/models/issue_label_test.go
@@ -38,11 +38,15 @@ func TestNewLabels(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
labels := []*Label{
{RepoID: 2, Name: "labelName2", Color: "#123456"},
- {RepoID: 3, Name: "labelName3", Color: "#23456F"},
+ {RepoID: 3, Name: "labelName3", Color: "#123"},
+ {RepoID: 4, Name: "labelName4", Color: "ABCDEF"},
+ {RepoID: 5, Name: "labelName5", Color: "DEF"},
}
assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: ""}))
- assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: "123456"}))
+ assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: "#45G"}))
assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: "#12345G"}))
+ assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: "45G"}))
+ assert.Error(t, NewLabel(&Label{RepoID: 3, Name: "invalid Color", Color: "12345G"}))
for _, label := range labels {
unittest.AssertNotExistsBean(t, label)
}