Show starred public repositories in the starred repos list

We forgot to check if the repository was public in the filter

Fixes https://jira.coreos.com/browse/QUAY-857
This commit is contained in:
Joseph Schorr 2018-05-31 17:34:17 -04:00
parent 9d30a0a216
commit 8ee98c1c48
4 changed files with 37 additions and 6 deletions

View file

@ -2,8 +2,9 @@ import pytest
from mock import patch, ANY, MagicMock
from data import model
from endpoints.api.test.shared import conduct_api_call
from endpoints.api.repository import RepositoryTrust, Repository
from endpoints.api.repository import RepositoryTrust, Repository, RepositoryList
from endpoints.test.shared import client_with_identity
from features import FeatureNameValue
@ -67,6 +68,31 @@ def test_signing_disabled(client):
assert not response['trust_enabled']
def test_sni_support():
import ssl
assert ssl.HAS_SNI
def test_list_starred_repos(client):
with client_with_identity('devtable', client) as cl:
params = {
'starred': 'true',
}
response = conduct_api_call(cl, RepositoryList, 'GET', params).json
repos = {r['namespace'] + '/' + r['name'] for r in response['repositories']}
assert 'devtable/simple' in repos
assert 'public/publicrepo' not in repos
# Add a star on publicrepo.
publicrepo = model.repository.get_repository('public', 'publicrepo')
model.repository.star_repository(model.user.get_user('devtable'), publicrepo)
# Ensure publicrepo shows up.
response = conduct_api_call(cl, RepositoryList, 'GET', params).json
repos = {r['namespace'] + '/' + r['name'] for r in response['repositories']}
assert 'devtable/simple' in repos
assert 'public/publicrepo' in repos
# Make publicrepo private and ensure it disappears.
model.repository.set_repository_visibility(publicrepo, 'private')
response = conduct_api_call(cl, RepositoryList, 'GET', params).json
repos = {r['namespace'] + '/' + r['name'] for r in response['repositories']}
assert 'devtable/simple' in repos
assert 'public/publicrepo' not in repos