-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from chosak/wagtail-2.6-support
Add support for Wagtail 2.6
- Loading branch information
Showing
7 changed files
with
88 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
install_requires = [ | ||
'Django>=1.8,<2.3', | ||
'tqdm==4.15.0', | ||
'wagtail>=1.8,<2.6', | ||
'wagtail>=1.8,<2.7', | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from django.core.management import call_command | ||
from django.test import TestCase | ||
from django.urls import reverse | ||
from django.utils.six.moves.urllib.parse import urlencode | ||
|
||
try: | ||
from wagtail.core.models import Page | ||
except ImportError: # pragma: no cover; fallback for Wagtail <2.0 | ||
from wagtail.wagtailcore.models import Page | ||
|
||
from wagtail.tests.utils import WagtailTestUtils | ||
|
||
|
||
class SearchViewTests(WagtailTestUtils, TestCase): | ||
fixtures = ['test_blocks.json'] | ||
|
||
def setUp(self): | ||
self.login() | ||
|
||
def get(self, params=None): | ||
path = reverse('wagtailinventory:search') | ||
|
||
if params: | ||
path += '?' + urlencode(params) | ||
|
||
return self.client.get(path) | ||
|
||
def test_empty_query_returns_200_and_all_pages_ordered_by_title(self): | ||
response = self.get() | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual( | ||
response.context['pages'].object_list, | ||
list(Page.objects.order_by('title')) | ||
) | ||
|
||
def test_get_bad_formset_query_returns_400(self): | ||
response = self.get({ | ||
'form-TOTAL_FORMS': 1, | ||
'form-INITIAL_FORMS': 0, | ||
'form-0-has': 'invalid', | ||
}) | ||
self.assertEqual(response.status_code, 400) | ||
|
||
def test_valid_query_returns_200_and_only_appropriate_pages(self): | ||
call_command('block_inventory', verbosity=0) | ||
|
||
response = self.get({ | ||
'form-TOTAL_FORMS': 1, | ||
'form-INITIAL_FORMS': 0, | ||
'form-0-has': 'includes', | ||
'form-0-block': 'wagtailinventory.tests.testapp.blocks.Organism', | ||
}) | ||
self.assertEqual(response.status_code, 200) | ||
self.assertEqual( | ||
response.context['pages'].object_list, | ||
[Page.objects.get(slug='multiple-streamfields-page')] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters