diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-28 19:58:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 12:58:28 +0100 |
commit | 1fee11d69a437ec7e68b3f6b645827592fe77292 (patch) | |
tree | 1fca452f96746d9f7cc8c31723e3c365155cf96d /models/access_test.go | |
parent | 24a8d54bfb908a2371cb808a5243b3290dd0664a (diff) | |
download | gitea-1fee11d69a437ec7e68b3f6b645827592fe77292.tar.gz gitea-1fee11d69a437ec7e68b3f6b645827592fe77292.zip |
Move accessmode into models/perm (#17828)
Diffstat (limited to 'models/access_test.go')
-rw-r--r-- | models/access_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/models/access_test.go b/models/access_test.go index a2fd05a033..05bd1656e9 100644 --- a/models/access_test.go +++ b/models/access_test.go @@ -8,6 +8,7 @@ import ( "testing" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/models/perm" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -35,34 +36,34 @@ func TestAccessLevel(t *testing.T) { level, err := AccessLevel(user2, repo1) assert.NoError(t, err) - assert.Equal(t, AccessModeOwner, level) + assert.Equal(t, perm.AccessModeOwner, level) level, err = AccessLevel(user2, repo3) assert.NoError(t, err) - assert.Equal(t, AccessModeOwner, level) + assert.Equal(t, perm.AccessModeOwner, level) level, err = AccessLevel(user5, repo1) assert.NoError(t, err) - assert.Equal(t, AccessModeRead, level) + assert.Equal(t, perm.AccessModeRead, level) level, err = AccessLevel(user5, repo3) assert.NoError(t, err) - assert.Equal(t, AccessModeNone, level) + assert.Equal(t, perm.AccessModeNone, level) // restricted user has no access to a public repo level, err = AccessLevel(user29, repo1) assert.NoError(t, err) - assert.Equal(t, AccessModeNone, level) + assert.Equal(t, perm.AccessModeNone, level) // ... unless he's a collaborator level, err = AccessLevel(user29, repo4) assert.NoError(t, err) - assert.Equal(t, AccessModeWrite, level) + assert.Equal(t, perm.AccessModeWrite, level) // ... or a team member level, err = AccessLevel(user29, repo24) assert.NoError(t, err) - assert.Equal(t, AccessModeRead, level) + assert.Equal(t, perm.AccessModeRead, level) } func TestHasAccess(t *testing.T) { @@ -105,7 +106,7 @@ func TestRepository_RecalculateAccesses(t *testing.T) { has, err := db.GetEngine(db.DefaultContext).Get(access) assert.NoError(t, err) assert.True(t, has) - assert.Equal(t, AccessModeOwner, access.Mode) + assert.Equal(t, perm.AccessModeOwner, access.Mode) } func TestRepository_RecalculateAccesses2(t *testing.T) { |