summaryrefslogtreecommitdiffstats
path: root/models/access_test.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-03-14 20:51:46 -0400
committerLunny Xiao <xiaolunwen@gmail.com>2017-03-15 08:51:46 +0800
commitec0ae5d50c59315a3c597b1cf24d4c5508c718e5 (patch)
tree6f4d6f826dd9866f9b39b66522ec629555700de2 /models/access_test.go
parent7d8f9d1c46e38681f2a4033a7da811ab7562d953 (diff)
downloadgitea-ec0ae5d50c59315a3c597b1cf24d4c5508c718e5.tar.gz
gitea-ec0ae5d50c59315a3c597b1cf24d4c5508c718e5.zip
Refactor and fix incorrect comment (#1247)
Diffstat (limited to 'models/access_test.go')
-rw-r--r--models/access_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/models/access_test.go b/models/access_test.go
index 6b3cce502c..29d40d9586 100644
--- a/models/access_test.go
+++ b/models/access_test.go
@@ -25,19 +25,19 @@ func TestAccessLevel(t *testing.T) {
repo1 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 2, IsPrivate: false}).(*Repository)
repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository)
- level, err := AccessLevel(user1, repo1)
+ level, err := AccessLevel(user1.ID, repo1)
assert.NoError(t, err)
assert.Equal(t, AccessModeOwner, level)
- level, err = AccessLevel(user1, repo2)
+ level, err = AccessLevel(user1.ID, repo2)
assert.NoError(t, err)
assert.Equal(t, AccessModeWrite, level)
- level, err = AccessLevel(user2, repo1)
+ level, err = AccessLevel(user2.ID, repo1)
assert.NoError(t, err)
assert.Equal(t, AccessModeRead, level)
- level, err = AccessLevel(user2, repo2)
+ level, err = AccessLevel(user2.ID, repo2)
assert.NoError(t, err)
assert.Equal(t, AccessModeNone, level)
}
@@ -51,19 +51,19 @@ func TestHasAccess(t *testing.T) {
repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository)
for _, accessMode := range accessModes {
- has, err := HasAccess(user1, repo1, accessMode)
+ has, err := HasAccess(user1.ID, repo1, accessMode)
assert.NoError(t, err)
assert.True(t, has)
- has, err = HasAccess(user1, repo2, accessMode)
+ has, err = HasAccess(user1.ID, repo2, accessMode)
assert.NoError(t, err)
assert.Equal(t, accessMode <= AccessModeWrite, has)
- has, err = HasAccess(user2, repo1, accessMode)
+ has, err = HasAccess(user2.ID, repo1, accessMode)
assert.NoError(t, err)
assert.Equal(t, accessMode <= AccessModeRead, has)
- has, err = HasAccess(user2, repo2, accessMode)
+ has, err = HasAccess(user2.ID, repo2, accessMode)
assert.NoError(t, err)
assert.Equal(t, accessMode <= AccessModeNone, has)
}