def test_new_video_should_create_empty_still_image_group_for_missing_src( self): video = self.create_video() del video.data['images'] import_video(video) assert self.repository['video']['2017-05']['myvid'].video_still is None assert self.repository['video']['2017-05']['myvid-still'] is not None
def test_inactive_video_should_be_imported_but_not_published(self): bc = self.create_video() bc.data['state'] = 'INACTIVE' import_video(bc) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') info = zeit.cms.workflow.interfaces.IPublishInfo(video) self.assertEqual(False, info.published)
def test_inactive_video_should_be_retracted(self): bc = self.create_video() import_video(bc) bc.data['state'] = 'INACTIVE' with mock.patch('zeit.workflow.publish.Publish.retract') as retract: import_video(bc) self.assertEqual(True, retract.called)
def test_new_video_should_be_added_to_cms(self): self.assertEqual( None, ICMSContent('http://xml.zeit.de/video/2017-05/myvid', None)) import_video(self.create_video()) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') self.assertEqual('title', video.title) info = zeit.cms.workflow.interfaces.IPublishInfo(video) self.assertEqual(True, info.published)
def test_deleted_video_should_be_retracted(self): bc = self.create_video() import_video(bc) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') deleted = zeit.brightcove.convert.DeletedVideo(bc.id, video) with mock.patch('zeit.workflow.publish.Publish.retract') as retract: import_video(deleted) self.assertEqual(True, retract.called)
def test_deleted_video_should_be_deleted_from_cms(self): bc = self.create_video() import_video(bc) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') deleted = zeit.brightcove.convert.DeletedVideo(bc.id, video) import_video(deleted) self.assertEqual( None, ICMSContent('http://xml.zeit.de/video/2017-05/myvid', None))
def test_ignored_video_should_not_be_updated_in_cms(self): bc = self.create_video() import_video(bc) bc.data['name'] = 'changed' bc.data['custom_fields']['ignore_for_update'] = '1' import_video(bc) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') self.assertEqual('title', video.title)
def test_new_video_should_bbb_copy_authors(self): author = zeit.content.author.author.Author() author.firstname = u'William' author.lastname = u'Shakespeare' self.repository['author'] = author bc = self.create_video() bc.data['custom_fields']['authors'] = 'http://xml.zeit.de/author' import_video(bc) video = ICMSContent('http://xml.zeit.de/video/2017-05/myvid') self.assertEqual(('William Shakespeare', ), video.authors)
def test_update_teaser_image_still_success(self): src = "http://{0.layer[http_address]}/testdata/opernball.jpg".format( self) bc = self.create_video() bc.data['images']['poster']['src'] = src imported = import_video(bc) assert imported.cmsobj.cms_video_still.master_image == 'opernball.jpg' new_src = "http://{0.layer[http_address]}/testdata/obama-clinton-120x120.jpg".format( self) bc.data['images']['poster']['src'] = new_src # importing it again triggers update: reimported = import_video(bc) assert reimported.cmsobj.cms_video_still.master_image == 'obama-clinton-120x120.jpg'
def test_download_teaser_image__still_success(self): src = "http://{0.layer[http_address]}/testdata/opernball.jpg".format( self) bc = self.create_video() bc.data['images']['poster']['src'] = src import_video(bc) # importing the video has created an image group "next to it" for its still image assert self.repository['video']['2017-05'][ 'myvid'].cms_video_still == self.repository['video']['2017-05'][ 'myvid-still'] self.assertEqual( True, zeit.cms.workflow.interfaces.IPublishInfo( ICMSContent( 'http://xml.zeit.de/video/2017-05/myvid-still')).published)
def test_download_teaser_image__thumbnail_success(self): src = "http://{0.layer[http_address]}/testdata/opernball.jpg".format( self) bc = self.create_video() bc.data['images']['thumbnail']['src'] = src import_video(bc) # importing the video has created an image group "next to it" for its thumbnail # and has assigned it as its thumbnail assert self.repository['video']['2017-05'][ 'myvid'].cms_thumbnail == self.repository['video']['2017-05'][ 'myvid-thumbnail'] # the video has been published self.assertEqual( True, zeit.cms.workflow.interfaces.IPublishInfo( ICMSContent( 'http://xml.zeit.de/video/2017-05/myvid')).published) # and so has the thumbnail self.assertEqual( True, zeit.cms.workflow.interfaces.IPublishInfo( ICMSContent('http://xml.zeit.de/video/2017-05/myvid-thumbnail') ).published)
def test_update_teaser_image_preserves_override(self): from zeit.content.image.testing import create_image_group_with_master_image src = "http://{0.layer[http_address]}/testdata/opernball.jpg".format( self) # video is created via BC import bc = self.create_video() bc.data['images']['poster']['src'] = src import_video(bc) # editor replaces automatically created video still with custom imagegroup self.repository[ 'foo-video_still'] = create_image_group_with_master_image() self.repository['video']['2017-05'][ 'myvid'].cms_video_still = self.repository['foo-video_still'] assert self.repository['video']['2017-05'][ 'myvid'].cms_video_still.master_image == 'master-image.jpg' # now an update from brightcove still updates the automatically created image group: new_src = "http://{0.layer[http_address]}/testdata/obama-clinton-120x120.jpg".format( self) bc.data['images']['poster']['src'] = new_src reimported = import_video(bc) assert self.repository['video']['2017-05'][ 'myvid-still'].master_image == 'obama-clinton-120x120.jpg' # but it does not change the reference of the video to the custom imagegroup assert reimported.cmsobj.cms_video_still.master_image == 'master-image.jpg'
def test_new_video_should_create_empty_thumbnail_image_group(self): import_video(self.create_video()) assert self.repository['video']['2017-05']['myvid'].thumbnail is None assert self.repository['video']['2017-05'][ 'myvid-thumbnail'] is not None