mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Revert "add a test for maximum page size enforcement"
This reverts commit af8e6f939ff2d3ecf4658e82777dcd35c0d288a8. This test seems to leak django.conf.settings between tests (causing the suite to fail periodically). Rolling this back until I can figure out why.
This commit is contained in:
parent
2e7a1eb3fe
commit
da66c3f2b8
@ -3,8 +3,6 @@
|
||||
import mock # noqa
|
||||
import pytest
|
||||
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.core.urlresolvers import reverse
|
||||
from awx.main.models import Project
|
||||
|
||||
@ -104,37 +102,6 @@ def test_user_project_paged_list_with_unicode(get, organization_factory):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_user_project_max_page_size(get, organization_factory):
|
||||
'Ensure that maximum page size is respected'
|
||||
|
||||
rest_settings = settings.REST_FRAMEWORK.copy()
|
||||
rest_settings['PAGE_SIZE'] = 1
|
||||
with override_settings(MAX_PAGE_SIZE=2, REST_FRAMEWORK=rest_settings):
|
||||
# 3 total projects, 1 per page, 3 pages
|
||||
objects = organization_factory(
|
||||
'org1',
|
||||
projects=['project-%s' % i for i in range(3)],
|
||||
users=['alice'],
|
||||
roles=['project-%s.admin_role:alice' % i for i in range(3)],
|
||||
)
|
||||
|
||||
# first page only shows one project
|
||||
pk = objects.users.alice.pk
|
||||
url = reverse('api:user_projects_list', args=(pk,))
|
||||
results = get(url, objects.users.alice).data
|
||||
assert len(results['results']) == 1
|
||||
assert results['next'] is not None
|
||||
|
||||
# page size of 2 is allowed
|
||||
results = get(url, objects.users.alice, QUERY_STRING='page_size=2').data
|
||||
assert len(results['results']) == 2
|
||||
|
||||
# page size of 3 is *not* allowed (max allowed is 2 per page)
|
||||
results = get(url, objects.users.alice, QUERY_STRING='page_size=3').data
|
||||
assert len(results['results']) == 2
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_user_project_list(get, organization_factory):
|
||||
'List of projects a user has access to, filtered by projects you can also see'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user