|
11 | 11 | from django.core import mail |
12 | 12 | from django.core.exceptions import ValidationError |
13 | 13 | from django.utils.timezone import now |
14 | | -from django.test.utils import override_settings |
| 14 | +from django.test.utils import override_settings, modify_settings |
15 | 15 |
|
16 | 16 | from newsletter.models import ( |
17 | 17 | Newsletter, Subscription, Submission, Message, Article, Attachment, SubscriptionGenerator, |
@@ -131,6 +131,22 @@ def test_image_thumbnail(self): |
131 | 131 | self.assertNotRegex(html, image_above_regex) |
132 | 132 | self.assertRegex(html, image_below_regex) |
133 | 133 |
|
| 134 | + @modify_settings(INSTALLED_APPS={'append': 'easy_thumbnails', 'remove': 'sorl.thumbnail'}) |
| 135 | + @override_settings(NEWSLETTER_THUMBNAIL='easy-thumbnails') |
| 136 | + def test_image_thumbnail_easy(self): |
| 137 | + a = self.make_article() |
| 138 | + a.image = os.path.join('tests', 'files', 'sample.jpg') |
| 139 | + a.save() |
| 140 | + _, _, html = render_message(self.m) |
| 141 | + self.assertEqual(a.image_thumbnail_size(), '200x200') |
| 142 | + self.assertIn('src="https://example.com/tests/files/sample.jpg.200x200_q85.jpg"', html) |
| 143 | + |
| 144 | + a.image_thumbnail_width = 400 |
| 145 | + a.save() |
| 146 | + _, _, html = render_message(self.m) |
| 147 | + self.assertEqual(a.image_thumbnail_size(), '400x300') |
| 148 | + self.assertIn('src="https://example.com/tests/files/sample.jpg.400x300_q85.jpg"', html) |
| 149 | + |
134 | 150 | @override_settings(NEWSLETTER_USE_HTTPS=False) |
135 | 151 | def test_http(self): |
136 | 152 | a = self.make_article() |
|
0 commit comments