aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_permission_test.go
diff options
context:
space:
mode:
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)