|
1 | 1 | from datetime import datetime, timedelta |
2 | 2 |
|
3 | | -from mock import patch, ANY |
4 | | -from django_webtest import WebTest |
| 3 | +from django.conf import settings |
5 | 4 | from django.contrib.admin import AdminSite |
6 | 5 | from django.contrib.admin.utils import quote |
| 6 | +from django.contrib.auth import get_user_model |
7 | 7 | from django.contrib.messages.storage.fallback import FallbackStorage |
8 | | -from django.test.utils import override_settings |
9 | | -from django.test.client import RequestFactory |
10 | 8 | from django.core.urlresolvers import reverse |
11 | | -from django.conf import settings |
12 | | -from django.contrib.auth import get_user_model |
| 9 | +from django.test.client import RequestFactory |
| 10 | +from django.test.utils import override_settings |
13 | 11 | from django.utils.encoding import force_text |
| 12 | +from django_webtest import WebTest |
| 13 | +from mock import ANY, patch |
14 | 14 |
|
| 15 | +from simple_history.admin import SimpleHistoryAdmin |
15 | 16 | from simple_history.models import HistoricalRecords |
16 | | -from simple_history.admin import SimpleHistoryAdmin, get_complete_version |
17 | | -from ..models import Book, Person, Poll, State, Employee, Choice, ConcreteExternal |
| 17 | +from ..models import Book, Choice, ConcreteExternal, Employee, Person, Poll, State |
18 | 18 |
|
19 | 19 | User = get_user_model() |
20 | 20 | today = datetime(2021, 1, 1, 10, 0) |
21 | 21 | tomorrow = today + timedelta(days=1) |
22 | 22 |
|
23 | | -extra_kwargs = {} |
24 | | -if get_complete_version() < (1, 8): |
25 | | - extra_kwargs = {'current_app': 'admin'} |
26 | | - |
27 | 23 |
|
28 | 24 | def get_history_url(obj, history_index=None, site="admin"): |
29 | 25 | app, model = obj._meta.app_label, obj._meta.model_name |
@@ -442,7 +438,7 @@ def test_history_form_view_without_getting_history(self): |
442 | 438 | 'root_path': getattr(admin_site, 'root_path', None), |
443 | 439 | } |
444 | 440 | mock_render.assert_called_once_with( |
445 | | - request, admin.object_history_form_template, context, **extra_kwargs) |
| 441 | + request, admin.object_history_form_template, context) |
446 | 442 |
|
447 | 443 | def test_history_form_view_getting_history(self): |
448 | 444 | request = RequestFactory().post('/') |
@@ -497,7 +493,7 @@ def test_history_form_view_getting_history(self): |
497 | 493 | 'root_path': getattr(admin_site, 'root_path', None), |
498 | 494 | } |
499 | 495 | mock_render.assert_called_once_with( |
500 | | - request, admin.object_history_form_template, context, **extra_kwargs) |
| 496 | + request, admin.object_history_form_template, context) |
501 | 497 |
|
502 | 498 | def test_history_form_view_getting_history_with_setting_off(self): |
503 | 499 | request = RequestFactory().post('/') |
@@ -551,7 +547,7 @@ def test_history_form_view_getting_history_with_setting_off(self): |
551 | 547 | 'root_path': getattr(admin_site, 'root_path', None), |
552 | 548 | } |
553 | 549 | mock_render.assert_called_once_with( |
554 | | - request, admin.object_history_form_template, context, **extra_kwargs) |
| 550 | + request, admin.object_history_form_template, context) |
555 | 551 |
|
556 | 552 | def test_history_form_view_getting_history_abstract_external(self): |
557 | 553 | request = RequestFactory().post('/') |
@@ -606,4 +602,4 @@ def test_history_form_view_getting_history_abstract_external(self): |
606 | 602 | 'root_path': getattr(admin_site, 'root_path', None), |
607 | 603 | } |
608 | 604 | mock_render.assert_called_once_with( |
609 | | - request, admin.object_history_form_template, context, **extra_kwargs) |
| 605 | + request, admin.object_history_form_template, context) |
0 commit comments