File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11from unittest import TestCase
2- from unittest .mock import MagicMock
2+
3+ import sys
34
45from django .contrib .admin import AdminSite
56
67from polymorphic_tree .tests .admin import TreeNodeParentAdmin
78from polymorphic_tree .tests .models import ModelWithCustomParentName
89
10+ if sys .version_info [0 ] == 3 :
11+ from unittest .mock import MagicMock
12+ else :
13+ from mock import MagicMock
14+
915
1016class PolymorphicAdminTests (TestCase ):
1117 """Tests for admin"""
@@ -33,5 +39,7 @@ def test_make_child2_child_child1(self):
3339 'position' : 'inside'
3440 }
3541 self .parent_admin .api_node_moved_view (request )
36- self .child2 .refresh_from_db ()
42+ # Analog of self.child2.refresh_from_db()
43+ # This hack used for django 1.7 support
44+ self .child2 = ModelWithCustomParentName .objects .get (pk = self .child2 .pk )
3745 self .assertEqual (self .child2 .chief , self .child1 )
Original file line number Diff line number Diff line change 2121 django19: django-mptt >= 0.8.0
2222 django110: Django >= 1.10, < 1.11
2323 django110: django-mptt >= 0.8.6
24+ py26: mock
25+ py27: mock
2426 django-dev: https://github.com/django/django/tarball/master
2527commands =
2628 python runtests.py
You can’t perform that action at this time.
0 commit comments