File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,22 @@ def test_parent_template_from_variable(self):
37
37
],
38
38
)
39
39
40
+
41
+ class TestGetTemplateDirs (SimpleTestCase ):
42
+ def get_relative_template_dirs (self ):
43
+ """Make paths relative with a predefined root so we can use them in assertions."""
44
+ base = os .path .dirname (settings .BASE_DIR )
45
+ dirs = get_template_dirs ()
46
+ return ['/' .join (str (d ).replace (base , 'dpl' ).split ('/' )[- 4 :- 1 ]) for d in dirs ]
47
+
40
48
@override_settings (TEMPLATES = [
41
49
{
42
50
'BACKEND' : 'django.template.backends.django.DjangoTemplates' ,
43
51
'APP_DIRS' : True ,
44
52
},
45
53
])
46
54
def test_get_template_dirs_app_dirs (self ):
47
- template_dirs = ['/' .join (d .replace (os .path .dirname (settings .BASE_DIR ), 'dpl' ).split ('/' )[- 4 :- 1 ]) for d in get_template_dirs ()]
48
- self .assertListEqual (template_dirs , [
55
+ self .assertListEqual (self .get_relative_template_dirs (), [
49
56
'django/contrib/auth' ,
50
57
'dpl/pattern_library' ,
51
58
'dpl/tests' ,
@@ -65,8 +72,7 @@ def test_get_template_dirs_app_dirs(self):
65
72
},
66
73
])
67
74
def test_get_template_dirs_list_dirs (self ):
68
- template_dirs = ['/' .join (d .replace (os .path .dirname (settings .BASE_DIR ), 'dpl' ).split ('/' )[- 4 :- 1 ]) for d in get_template_dirs ()]
69
- self .assertListEqual (template_dirs , [
75
+ self .assertListEqual (self .get_relative_template_dirs (), [
70
76
'dpl/tests/test_one' ,
71
77
'dpl/tests/test_two' ,
72
78
'django/contrib/auth' ,
You can’t perform that action at this time.
0 commit comments