def test_show_thumbnail(self): event = Event.objects.get(title='Test event') self._attach_file(event, self.main_image) html = show_thumbnail(event, geometry='111x99') ok_('width="111"' in html) ok_('height="99"' in html) ok_('alt="%s"' % event.title in html) # suppose the event has a picture now with open(self.main_image) as fp: picture = Picture.objects.create(file=File(fp)) event.picture = picture event.save() new_html = show_thumbnail(event, geometry='111x99') ok_(new_html != html) ok_('width="111"' in new_html) ok_('height="99"' in new_html) ok_('alt="%s"' % event.title in new_html)
def test_show_lazyr_thumbnail(self): event = Event.objects.get(title='Test event') self._attach_file(event, self.main_image) html = show_lazyr_thumbnail(event) ok_('data-layzr=' not in html) eq_(html, show_thumbnail(event)) with open(self.main_image) as fp: Picture.objects.create(file=File(fp), default_placeholder=True) html = show_lazyr_thumbnail(event, geometry='111x99') ok_('data-layzr=' in html)
def test_show_lazyr_thumbnail(self): event = Event.objects.get(title='Test event') self._attach_file(event, self.main_image) html = show_lazyr_thumbnail(event) ok_('data-layzr=' not in html) eq_(html, show_thumbnail(event)) with open(self.main_image) as fp: Picture.objects.create( file=File(fp), default_placeholder=True ) html = show_lazyr_thumbnail(event, geometry='111x99') ok_('data-layzr=' in html)