Commit graph

333 commits

Author SHA1 Message Date
Tim Heap
f9b39e5890 Do not get message classes from MESSAGE_TAGS
If the developer had overridden MESSAGE_TAGS in their site, Wagtail
messages used these classes in the admin. This caused the messages to
lose their styles.

Wagtail now ignores the MESSAGE_TAGS setting, using the default classes
defined in `django.contrib.messages.constants.LEVEL_TAGS`.

Fixes #2551

Conflicts:
	wagtail/tests/testapp/urls.py
	wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py
2016-05-03 11:52:09 +01:00
Tim Heap
9e6a56765f Add tests for snippet edit handler form classes 2016-03-30 19:53:19 +01:00
Matt Westcott
a6647c33c8 Use specific page models on explorer page listing.
In particular, this ensures that any custom URL routes defined on the page model
are respected by the 'live' link:
https://groups.google.com/d/msg/wagtail/qAmI4HbJfCI/9fxvoCmMEQAJ
2016-03-07 10:00:45 +00:00
Mike Dingjan
0b2dd256b2 removed setting again 2016-03-03 23:05:34 +03:00
Mike Dingjan
0e52439ba1 removed site_url and depend on the BASE_URL, like it used to do 2016-03-03 23:05:34 +03:00
Liam Brenner
8ca7e807d9 Added tests 2016-03-03 02:02:52 +02:00
Tim Heap
c5dd198856 Fix incorrect user creation in account tests
Instead of using `User.objects.create_user`, `User.objects.create` was
used, which does not correctly set the password. The user was then not
logged in, as they had an incorrect password. This error was not caught
by the log in method, or the following tests, as the behaviour for a
user with incorrect permissions was the same as for anonymous users.

The code now uses the correct method, and the tests now assert that the
user is actually logged in.
2016-03-01 15:46:38 +00:00
Adam Bolfik
c3d2bb52ac Created an overridable function to allow for custom user models. Also, changed the account_management tests to get the test_user via the pk. 2016-03-01 15:06:24 +00:00
Adam
416e4be27b Change test util to handle custom user models
This should handle custom user models that use either username or email as the 'USERNAME_FIELD'
2016-03-01 15:05:21 +00:00
Karl Hobley
b832672811 feat(api/2): Added new module for WagtailAPI v2 2016-03-01 13:12:24 +00:00
Karl Hobley
e3504af94c feat(api): Added wagtail.api module 2016-03-01 13:12:24 +00:00
Matt Westcott
6bae4f04ca Enable template debugging on tests, to catch broken includes 2016-03-01 12:23:53 +00:00
Matt Westcott
382cf37d99 Make Image model a collection member 2016-02-29 13:14:06 +00:00
Karl Hobley
ff9289fdb0 Regenerated test app migrations 2016-02-17 16:56:00 +00:00
Karl Hobley
43e4f0ad1f Added on_delete actions into migrations
This removes a lot of deprecation warnings
2016-02-17 16:56:00 +00:00
Matt Westcott
074911d504 Implement construct_explorer_page_queryset hook 2016-02-12 11:15:13 +00:00
Tim Heap
224f3f5c37 Remove final references to django-compressor
* Remove references from docs
* Fix comment in SCSS files, and fix related variable names
* Remove COMPRESS_ENABLED setting from tests
2016-02-09 18:41:56 +00:00
Karl Hobley
be82fa975d Removed django-compressor 2016-02-03 16:16:11 +00:00
Mikalai Radchuk
3f2f5665b0 Allow specifying custom edit handlers for snippets 2016-01-28 13:03:27 +00:00
Tim Heap
5714a6a3ab Set base_form_class for SimplePage.edit_handler 2016-01-25 14:18:49 +00:00
Tim Heap
eda5b86bee Add tests for custom page form classes 2016-01-25 14:18:48 +00:00
Matt Westcott
3e5c665014 Fix CustomUserManager._create_user to allow passing is_active=False 2016-01-25 09:58:00 +00:00
Matt Westcott
3e439b7bec Remove Django 1.7 code from migrations and tests 2016-01-06 14:01:58 +00:00
Karl Hobley
84261dec77 deprecation/1.4: WagtailAPI now requires rest_framework 2016-01-05 11:29:08 +00:00
Tim Heap
c1c32b5599 Add failing test for abstract page managers
Custom page managers set on abstract pages would cause an error on start
up, as accessing the manager of an abstract page is invalid.
2015-12-24 09:52:21 +11:00
Matt Westcott
eccb0990bb Add test for user_passes_test decorator 2015-12-17 09:13:03 +00:00
Rich Atkinson
aaed92f301 do not delete uploaded images or page revisions when a user is deleted. fixes #1918 2015-12-15 17:06:37 +00:00
Tim Heap
2c76441186 Add docs for WagtailPageTests 2015-12-15 15:49:40 +00:00
Tim Heap
36cb270885 Add assertions for subpage, parent page types to test helper
Two new assertions have been added: `assertAllowedSubpageTypes` and
`assertAllowedParentPageTypes`. They both take a Page class, and a set
of Page classes, and compares the allowed subpage / parent page models
for the Page class to the set passed in.
2015-12-15 15:49:39 +00:00
Tim Heap
6947eab55b Add test helpers for Wagtail sites
`wagtail.tests.utils.WagtailPageTests` is a new `TestCase` subclass that
helps developers write tests for their Wagtail sites. It currently
includes three assert methods:

`assertCanCreateAt(parent_model, child_model)`, which asserts that a
child page of a certain type could be created underneath a parent page.
This is useful for making assertions around the business rules of your
site.

`assertCanNotCreateAt(parent_model, child_model)` is the inverse of the
above.

`assertCanCreate(parent, child_model, data)` asserts that a child page
can be added underneath the given parent page, by POSTing `data` at the
correct page in the Wagtail admin. This checks that the developer has
correctly configured their `content_panels` and related options.

These methods are just a start, and could be expanded further. More
methods could be added, asserting that Snippets can be created, for
example. The current methods could be extended further, to validate more
about the Wagtail admin page editor.
2015-12-15 15:48:36 +00:00
Tim Heap
9e8c2c2d5f Allow custom Page Managers
Previously, if a developer wanted to use a custom Manager on their Page
subclass, some fairly hacky hacks were required. Now, the `objects`
attribute is only overridden if it is a plain `Manager`. If it is
anything else, it is left alone. A system check has been added to ensure
that all `Page` managers inherit from `PageManager`
2015-12-14 23:09:45 +00:00
Ben Kerle
973c290e77 Basic tests for admin search hook 2015-12-14 21:21:45 +00:00
Karl Hobley
3bce07f26f Test ForeignKey with RelatedFields 2015-12-11 12:29:27 +00:00
Karl Hobley
ca83c43e3c Added support for indexing relations in wagtailsearch 2015-12-11 12:29:26 +00:00
Karl Hobley
960d7aa575 feat(django 1.9): Move jinja2 tags out of templatetags folders
Django 1.9 now automatically imports all models in templatetags. This causes ImportErrors to be raised for users who do not have jinja2 installed.
2015-12-09 11:40:35 +00:00
Maris Serzans
32b4124767 Changed verbose names to start with lowercase when necessary 2015-12-08 17:33:19 +00:00
Maris Serzans
c92d12755c pep8 compliance 120 characters / line 2015-12-08 14:50:32 +00:00
Matt Westcott
16787e7150 fix pep8 spacing fix broken while merging beb2b927d7 2015-12-08 14:46:10 +00:00
Ben Emery
beb2b927d7 Allow for overriding image upload path 2015-12-07 19:18:17 +00:00
Karl Hobley
1957af9ea8 Cleanup E302 errors 2015-12-04 09:32:16 +00:00
Tim Heap
0071d85aa0 Add Page methods can_move_to and can_create_at
These two tests are used when checking if a new page type can be created
under a page instance, or if an existing page type can move under a page
instance.
2015-12-03 12:56:52 +00:00
Matt Westcott
3e127ebe03 add new fixtures to test subpage_types business rules when moving pages 2015-12-03 12:56:51 +00:00
Matt Westcott
1bb74ee4d0 Remove special case allowing all page types to be children of Page.
This was required when Page was absent from PAGE_MODEL_CLASSES (due to
it being 'abstract' / non-creatable) and thus never appeared in a
parent_page_types list. Now it appears in PAGE_MODEL_CLASSES, and is
a valid parent page type for page types that do not specify
parent_page_types (or explicitly include Page in the list).
2015-12-01 12:35:30 +00:00
Matt Westcott
5104643438 Change PAGE_MODEL_CLASSES to include is_creatable pages 2015-12-01 12:35:30 +00:00
Karl Hobley
06cba807df Merge pull request #1914 from kaedroho/runtests-args
Add --postgres and --elasticsearch arguments to runtests.py
2015-11-30 12:26:16 +00:00
alx
88e477098f Ensure that locked pages can't be unpublished.
Fixes #1615
2015-11-24 12:58:02 +00:00
Karl Hobley
7459329d93 Added --elasticsearch argument to runtests.py 2015-11-09 12:13:07 +00:00
Karl Hobley
5a9db599ec Merge pull request #1890 from gasman/fix/structblock-template-gets-structvalue
Pass the original StructValue to StructBlock templates so that value.bound_blocks works
2015-11-02 15:24:36 +00:00
Karl Hobley
ed920aff7f Merge pull request #1881 from gasman/fix/use-live-revision-when-available
Show the live database record in the page editor if there are no draft edits
2015-11-02 11:19:18 +00:00
Matt Westcott
b041f2e740 Test that value.bound_block is available on struct_block templates 2015-10-31 19:01:39 +00:00