-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatibility fixes for Django 1.10 compatibility, stronger tests, ex…
…clude_modeladmins option (#8) * remove old queryset testing since Django<1.8 support was dropped, so this is not tested anymore it breaks tests when queryset method is defined on modeladmin for compatibility reasons * stronger tests render respose add change_view test * add exclude_modeladmins option * test also search request to identify bad search_fields settings * test in Django 1.10; show all warnings * fix tests in Django 1.10 * test that exceptions are raised, throw own exception class, increase coverage * include python 3.4, django 1.7 Travis test * remove old deprecated code * test and fix catching PermissionDenied exception - use it where it is needed * fix backward compatibility with Python 2.7 * print python version to ensure correct testing * test request.GET parameter * check import order with flake8; fix all import orders * use isinstance instead of __class__ * run tests with USE_TZ=True (add pytz dependency to tox) * fix tox Django version order * test also some aspects of posting change_view
- Loading branch information
1 parent
53ecdfa
commit 746382c
Showing
9 changed files
with
222 additions
and
33 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
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
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,38 @@ | ||
import django | ||
|
||
from django.test import TestCase | ||
from django_admin_smoke_tests.tests import AdminSiteSmokeTestMixin,\ | ||
ModelAdminCheckException, for_all_model_admins | ||
from .admin import ChannelAdmin, FailPostAdmin, ForbiddenPostAdmin, PostAdmin | ||
|
||
|
||
class AdminSiteSmokeTest(AdminSiteSmokeTestMixin, TestCase): | ||
fixtures = [] | ||
exclude_apps = ['auth'] | ||
exclude_modeladmins = [FailPostAdmin, ForbiddenPostAdmin] | ||
|
||
|
||
class FailAdminSiteSmokeTest(AdminSiteSmokeTestMixin, TestCase): | ||
fixtures = [] | ||
exclude_modeladmins = [ForbiddenPostAdmin, PostAdmin, ChannelAdmin] | ||
|
||
@for_all_model_admins | ||
def test_specified_fields(self, model, model_admin): | ||
with self.assertRaises(ModelAdminCheckException): | ||
super(FailAdminSiteSmokeTest, self).test_specified_fields() | ||
|
||
@for_all_model_admins | ||
def test_changelist_view_search(self, model, model_admin): | ||
with self.assertRaises(ModelAdminCheckException): | ||
super(FailAdminSiteSmokeTest, self).test_changelist_view_search() | ||
|
||
if django.VERSION >= (1, 8): | ||
@for_all_model_admins | ||
def test_changelist_view(self, model, model_admin): | ||
with self.assertRaises(ModelAdminCheckException): | ||
super(FailAdminSiteSmokeTest, self).test_changelist_view() | ||
|
||
|
||
class ForbiddenAdminSiteSmokeTest(AdminSiteSmokeTestMixin, TestCase): | ||
fixtures = [] | ||
exclude_modeladmins = [FailPostAdmin, PostAdmin, ChannelAdmin] |
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
Oops, something went wrong.