|
10 | 10 | from django.core import mail
|
11 | 11 | from django.core.exceptions import ImproperlyConfigured
|
12 | 12 | from django.test import RequestFactory
|
| 13 | +from django.test.utils import override_settings |
13 | 14 | from django.utils.html import escape
|
14 | 15 | from django.utils.timezone import now
|
15 | 16 | from djangocms_text_ckeditor.cms_plugins import TextPlugin
|
16 | 17 |
|
17 | 18 | from sekizai.data import UniqueSequence
|
18 | 19 | from sekizai.helpers import get_varname
|
19 | 20 |
|
| 21 | +from mock import patch |
| 22 | + |
20 | 23 | import cms
|
21 | 24 | from cms.api import create_page, create_title, add_plugin
|
22 | 25 | from cms.middleware.toolbar import ToolbarMiddleware
|
@@ -100,6 +103,25 @@ def test_static_with_version(self):
|
100 | 103 | output = self.render_template_obj(template, {}, None)
|
101 | 104 | self.assertEqual(expected, output)
|
102 | 105 |
|
| 106 | + @override_settings(STATICFILES_STORAGE='django.contrib.staticfiles.storage.ManifestStaticFilesStorage') |
| 107 | + @patch('django.contrib.staticfiles.storage.staticfiles_storage') |
| 108 | + def test_static_with_version_manifest(self, mock_storage): |
| 109 | + """ |
| 110 | + Check that static files are looked up at the location where they are |
| 111 | + stored when using static file manifests. |
| 112 | + """ |
| 113 | + mock_storage.url.side_effect = lambda x: '/static/' + x |
| 114 | + expected = 'cms/css/%(version)s/cms.base.css' |
| 115 | + expected = expected % {'version': cms.__version__} |
| 116 | + |
| 117 | + template = ( |
| 118 | + """{% load cms_static %}<script src="{% static_with_version "cms/css/cms.base.css" %}" """ |
| 119 | + """type="text/javascript"></script>""" |
| 120 | + ) |
| 121 | + |
| 122 | + self.render_template_obj(template, {}, None) |
| 123 | + mock_storage.url.assert_called_with(expected) |
| 124 | + |
103 | 125 |
|
104 | 126 | class TemplatetagDatabaseTests(TwoPagesFixture, CMSTestCase):
|
105 | 127 | def _getfirst(self):
|
|
0 commit comments