aboutsummaryrefslogtreecommitdiffstats
path: root/modules/auth/repo_form_test.go
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2019-02-18 21:55:04 +0100
committerLauris BH <lauris@nix.lv>2019-02-18 22:55:04 +0200
commit44114b38e601c8bf44f575daef1d0e0597f37d1d (patch)
treed2d271b31bff505a09c2faf04d5fea69a9f9d58c /modules/auth/repo_form_test.go
parent64ce159a6eacc81962d07a8f5ef7f69c17365363 (diff)
downloadgitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.tar.gz
gitea-44114b38e601c8bf44f575daef1d0e0597f37d1d.zip
Implement "conversation lock" for issue comments (#5073)
Diffstat (limited to 'modules/auth/repo_form_test.go')
-rw-r--r--modules/auth/repo_form_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/auth/repo_form_test.go b/modules/auth/repo_form_test.go
index f6223d6c8a..a3369b006e 100644
--- a/modules/auth/repo_form_test.go
+++ b/modules/auth/repo_form_test.go
@@ -7,6 +7,7 @@ package auth
import (
"testing"
+ "code.gitea.io/gitea/modules/setting"
"github.com/stretchr/testify/assert"
)
@@ -39,3 +40,27 @@ func TestSubmitReviewForm_IsEmpty(t *testing.T) {
assert.Equal(t, v.expected, v.form.HasEmptyContent())
}
}
+
+func TestIssueLock_HasValidReason(t *testing.T) {
+
+ // Init settings
+ _ = setting.Repository
+
+ cases := []struct {
+ form IssueLockForm
+ expected bool
+ }{
+ {IssueLockForm{""}, true}, // an empty reason is accepted
+ {IssueLockForm{"Off-topic"}, true},
+ {IssueLockForm{"Too heated"}, true},
+ {IssueLockForm{"Spam"}, true},
+ {IssueLockForm{"Resolved"}, true},
+
+ {IssueLockForm{"ZZZZ"}, false},
+ {IssueLockForm{"I want to lock this issue"}, false},
+ }
+
+ for _, v := range cases {
+ assert.Equal(t, v.expected, v.form.HasValidReason())
+ }
+}