summaryrefslogtreecommitdiffstats
path: root/models/repo_permission_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-10 03:57:58 +0800
committerGitHub <noreply@github.com>2021-11-09 20:57:58 +0100
commit99b2858e628d92bba252be72def409af77af735b (patch)
tree56159cf10b271307911e6f01626c0c3efba789ab /models/repo_permission_test.go
parentb6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff)
downloadgitea-99b2858e628d92bba252be72def409af77af735b.tar.gz
gitea-99b2858e628d92bba252be72def409af77af735b.zip
Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
Diffstat (limited to 'models/repo_permission_test.go')
-rw-r--r--models/repo_permission_test.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/models/repo_permission_test.go b/models/repo_permission_test.go
index 1fbf1b9f8f..5e43937776 100644
--- a/models/repo_permission_test.go
+++ b/models/repo_permission_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/unit"
"github.com/stretchr/testify/assert"
)
@@ -165,8 +166,8 @@ func TestRepoPermissionPublicOrgRepo(t *testing.T) {
for _, unit := range repo.Units {
assert.True(t, perm.CanRead(unit.Type))
}
- assert.True(t, perm.CanWrite(UnitTypeIssues))
- assert.False(t, perm.CanWrite(UnitTypeCode))
+ assert.True(t, perm.CanWrite(unit.TypeIssues))
+ assert.False(t, perm.CanWrite(unit.TypeCode))
// admin
admin := db.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User)
@@ -235,17 +236,17 @@ func TestRepoPermissionPrivateOrgRepo(t *testing.T) {
tester := db.AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
perm, err = GetUserRepoPermission(repo, tester)
assert.NoError(t, err)
- assert.True(t, perm.CanWrite(UnitTypeIssues))
- assert.False(t, perm.CanWrite(UnitTypeCode))
- assert.False(t, perm.CanRead(UnitTypeCode))
+ assert.True(t, perm.CanWrite(unit.TypeIssues))
+ assert.False(t, perm.CanWrite(unit.TypeCode))
+ assert.False(t, perm.CanRead(unit.TypeCode))
// org member team reviewer
reviewer := db.AssertExistsAndLoadBean(t, &User{ID: 20}).(*User)
perm, err = GetUserRepoPermission(repo, reviewer)
assert.NoError(t, err)
- assert.False(t, perm.CanRead(UnitTypeIssues))
- assert.False(t, perm.CanWrite(UnitTypeCode))
- assert.True(t, perm.CanRead(UnitTypeCode))
+ assert.False(t, perm.CanRead(unit.TypeIssues))
+ assert.False(t, perm.CanWrite(unit.TypeCode))
+ assert.True(t, perm.CanRead(unit.TypeCode))
// admin
admin := db.AssertExistsAndLoadBean(t, &User{ID: 1}).(*User)