class Migration(migrations.Migration): dependencies = [ ('djangocms_picture', '0005_reset_null_values'), ] operations = [ migrations.AlterField( model_name='picture', name='link_url', field=models.URLField( default='', help_text='Wraps the image in a link to an external URL.', max_length=2040, verbose_name='External URL', blank=True), preserve_default=False, ), migrations.AlterField( model_name='picture', name='alignment', field=models.CharField( default='', choices=get_alignment(), max_length=255, blank=True, help_text='Aligns the image according to the selected option.', verbose_name='Alignment'), preserve_default=False, ), ]
def test_plugin_structure(self): request_url = self.page.get_absolute_url( self.language) + "?toolbar_off=true" plugin = add_plugin( placeholder=self.placeholder, plugin_type=PicturePlugin.__name__, language=self.language, picture=self.picture, ) self.page.publish(self.language) self.assertEqual(plugin.get_plugin_class_instance().name, "Image") with self.login_user_context(self.superuser): response = self.client.get(request_url) self.assertContains( response, 'src="/media/filer_public_thumbnails/filer_public') # test that alignment is added plugin = add_plugin( placeholder=self.placeholder, plugin_type=PicturePlugin.__name__, language=self.language, picture=self.picture, alignment=get_alignment()[1][0], ) self.page.publish(self.language) self.assertEqual(plugin.get_plugin_class_instance().name, "Image") with self.login_user_context(self.superuser): response = self.client.get(request_url) self.assertContains(response, 'align-right')
def test_settings(self): self.assertEqual(get_templates(), [('default', 'Default')]) settings.DJANGOCMS_PICTURE_TEMPLATES = [('feature', 'Feature')] self.assertEqual(get_templates(), [('default', 'Default'), ('feature', 'Feature')]) self.assertEqual(PICTURE_RATIO, 1.6180) self.assertEqual( get_alignment(), (('left', 'Align left'), ('right', 'Align right'), ('center', 'Align center')), )
class Migration(migrations.Migration): dependencies = [ ('djangocms_picture', '0006_remove_null_values'), ] operations = [ migrations.AlterField( model_name='picture', name='alignment', field=models.CharField( blank=True, help_text='Aligns the image according to the selected option.', max_length=255, verbose_name='Alignment', choices=get_alignment()), ), ]
def setUp(self): self.page = create_page( title="help", template="page.html", language="en", ) self.picture = Picture.objects.create( template="default", picture=get_filer_image(), width=720, height=480, alignment=get_alignment()[0][0], caption_text="some caption", attributes="{'data-type', 'picture'}", link_url="http://www.divio.com", link_page=self.page, link_target=LINK_TARGET[0][0], link_attributes="{'data-type', 'picture'}", ) self.external_picture = 'https://www.google.com/images/logo.png'