|
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
|
@@ -437,7 +433,7 @@ def test_history_form_view_without_getting_history(self):
|
437 | 433 | 'root_path': getattr(admin_site, 'root_path', None),
|
438 | 434 | }
|
439 | 435 | mock_render.assert_called_once_with(
|
440 |
| - request, admin.object_history_form_template, context, **extra_kwargs) |
| 436 | + request, admin.object_history_form_template, context) |
441 | 437 |
|
442 | 438 | def test_history_form_view_getting_history(self):
|
443 | 439 | request = RequestFactory().post('/')
|
@@ -492,7 +488,7 @@ def test_history_form_view_getting_history(self):
|
492 | 488 | 'root_path': getattr(admin_site, 'root_path', None),
|
493 | 489 | }
|
494 | 490 | mock_render.assert_called_once_with(
|
495 |
| - request, admin.object_history_form_template, context, **extra_kwargs) |
| 491 | + request, admin.object_history_form_template, context) |
496 | 492 |
|
497 | 493 | def test_history_form_view_getting_history_with_setting_off(self):
|
498 | 494 | request = RequestFactory().post('/')
|
@@ -546,7 +542,7 @@ def test_history_form_view_getting_history_with_setting_off(self):
|
546 | 542 | 'root_path': getattr(admin_site, 'root_path', None),
|
547 | 543 | }
|
548 | 544 | mock_render.assert_called_once_with(
|
549 |
| - request, admin.object_history_form_template, context, **extra_kwargs) |
| 545 | + request, admin.object_history_form_template, context) |
550 | 546 |
|
551 | 547 | def test_history_form_view_getting_history_abstract_external(self):
|
552 | 548 | request = RequestFactory().post('/')
|
@@ -601,4 +597,4 @@ def test_history_form_view_getting_history_abstract_external(self):
|
601 | 597 | 'root_path': getattr(admin_site, 'root_path', None),
|
602 | 598 | }
|
603 | 599 | mock_render.assert_called_once_with(
|
604 |
| - request, admin.object_history_form_template, context, **extra_kwargs) |
| 600 | + request, admin.object_history_form_template, context) |
0 commit comments