diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2018-06-21 18:00:13 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-06-21 12:00:13 -0400 |
commit | 0b3ea428477b9da33f40252e79aafe85b09526f3 (patch) | |
tree | 4fccc7dbf7f027331735d7d041bc290db632b744 /models/access_test.go | |
parent | 46d19c4676efe5201c5de790bcb963bfc93a95c7 (diff) | |
download | gitea-0b3ea428477b9da33f40252e79aafe85b09526f3.tar.gz gitea-0b3ea428477b9da33f40252e79aafe85b09526f3.zip |
hide issues from org private repos w/o team assignment (#4034)
Diffstat (limited to 'models/access_test.go')
-rw-r--r-- | models/access_test.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/models/access_test.go b/models/access_test.go index 59575acb7d..46d6f723ea 100644 --- a/models/access_test.go +++ b/models/access_test.go @@ -22,8 +22,12 @@ func TestAccessLevel(t *testing.T) { user1 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) user2 := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User) - repo1 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 2, IsPrivate: false}).(*Repository) - repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository) + // A public repository owned by User 2 + repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) + assert.False(t, repo1.IsPrivate) + // A private repository owned by Org 3 + repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) + assert.True(t, repo2.IsPrivate) level, err := AccessLevel(user1.ID, repo1) assert.NoError(t, err) @@ -47,8 +51,12 @@ func TestHasAccess(t *testing.T) { user1 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) user2 := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User) - repo1 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 2, IsPrivate: false}).(*Repository) - repo2 := AssertExistsAndLoadBean(t, &Repository{OwnerID: 3, IsPrivate: true}).(*Repository) + // A public repository owned by User 2 + repo1 := AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository) + assert.False(t, repo1.IsPrivate) + // A private repository owned by Org 3 + repo2 := AssertExistsAndLoadBean(t, &Repository{ID: 3}).(*Repository) + assert.True(t, repo2.IsPrivate) for _, accessMode := range accessModes { has, err := HasAccess(user1.ID, repo1, accessMode) |