Merge pull request #2529 from coreos-inc/search-ui

Implement new search UI
This commit is contained in:
josephschorr 2017-05-02 15:56:59 -04:00 committed by GitHub
commit 5a9a231754
23 changed files with 649 additions and 393 deletions

View file

@ -0,0 +1,12 @@
from endpoints.api.search import ConductRepositorySearch
from endpoints.api.test.shared import client_with_identity, conduct_api_call
from test.fixtures import *
def test_repository_search(client):
with client_with_identity('devtable', client) as cl:
params = {'query': 'simple'}
result = conduct_api_call(cl, ConductRepositorySearch, 'GET', params, None, 200).json
assert not result['has_additional']
assert result['start_index'] == 0
assert result['page'] == 1
assert result['results'][0]['name'] == 'simple'

View file

@ -4,16 +4,18 @@ from flask_principal import AnonymousIdentity
from endpoints.api import api
from endpoints.api.team import OrganizationTeamSyncing
from endpoints.api.test.shared import client_with_identity, conduct_api_call
from endpoints.api.repository import RepositoryTrust
from endpoints.api.signing import RepositorySignatures
from endpoints.api.search import ConductRepositorySearch
from endpoints.api.superuser import SuperUserRepositoryBuildLogs, SuperUserRepositoryBuildResource
from endpoints.api.superuser import SuperUserRepositoryBuildStatus
from endpoints.api.signing import RepositorySignatures
from endpoints.api.repository import RepositoryTrust
from test.fixtures import *
TEAM_PARAMS = {'orgname': 'buynlarge', 'teamname': 'owners'}
BUILD_PARAMS = {'build_uuid': 'test-1234'}
REPO_PARAMS = {'repository': 'devtable/someapp'}
SEARCH_PARAMS = {'query': ''}
@pytest.mark.parametrize('resource,method,params,body,identity,expected', [
(OrganizationTeamSyncing, 'POST', TEAM_PARAMS, {}, None, 403),
@ -26,6 +28,11 @@ REPO_PARAMS = {'repository': 'devtable/someapp'}
(OrganizationTeamSyncing, 'DELETE', TEAM_PARAMS, {}, 'reader', 403),
(OrganizationTeamSyncing, 'DELETE', TEAM_PARAMS, {}, 'devtable', 200),
(ConductRepositorySearch, 'GET', SEARCH_PARAMS, None, None, 200),
(ConductRepositorySearch, 'GET', SEARCH_PARAMS, None, 'freshuser', 200),
(ConductRepositorySearch, 'GET', SEARCH_PARAMS, None, 'reader', 200),
(ConductRepositorySearch, 'GET', SEARCH_PARAMS, None, 'devtable', 200),
(SuperUserRepositoryBuildLogs, 'GET', BUILD_PARAMS, None, None, 401),
(SuperUserRepositoryBuildLogs, 'GET', BUILD_PARAMS, None, 'freshuser', 403),
(SuperUserRepositoryBuildLogs, 'GET', BUILD_PARAMS, None, 'reader', 403),