def test_converts_cms_fields_to_bc_names(self): cms = CMSVideo() cms.title = u'title' cms.teaserText = u'teaser' bc = BCVideo.from_cms(cms) self.assertEqual('title', bc.data['name']) self.assertEqual('teaser', bc.data['description'])
def test_converts_related(self): cms = CMSVideo() related = zeit.cms.related.interfaces.IRelatedContent(cms) related.related = (zeit.cms.interfaces.ICMSContent( 'http://xml.zeit.de/online/2007/01/eta-zapatero'), ) bc = BCVideo.from_cms(cms) self.assertEqual('http://xml.zeit.de/online/2007/01/eta-zapatero', bc.data['custom_fields']['ref_link1'])
def test_converts_authors(self): from zeit.content.author.author import Author self.repository['a1'] = Author() self.repository['a2'] = Author() cms = CMSVideo() cms.authorships = (cms.authorships.create(self.repository['a1']), cms.authorships.create(self.repository['a2'])) bc = BCVideo.from_cms(cms) self.assertEqual('http://xml.zeit.de/a1 http://xml.zeit.de/a2', bc.data['custom_fields']['authors'])
def test_only_strings_in_custom_fields(self): from zeit.content.author.author import Author self.repository['a1'] = Author() cms = CMSVideo() cms.authorships = (cms.authorships.create(self.repository['a1']), ) cms.product = zeit.cms.content.sources.PRODUCT_SOURCE(None).find( 'TEST') bc = BCVideo.from_cms(cms) for key, value in bc.data['custom_fields'].items(): self.assertIsInstance(value, six.string_types, '%s should be a string' % key)
def test_converts_channels(self): cms = CMSVideo() cms.channels = (('Deutschland', 'Meinung'), ('International', None)) bc = BCVideo.from_cms(cms) self.assertEqual('Deutschland Meinung;International', bc.data['custom_fields']['channels'])
def test_converts_serie(self): cms = CMSVideo() cms.serie = zeit.content.video.interfaces.IVideo['serie'].source( None).find('Chefsache') bc = BCVideo.from_cms(cms) self.assertEqual('Chefsache', bc.data['custom_fields']['serie'])
def test_converts_product(self): cms = CMSVideo() cms.product = zeit.cms.content.sources.PRODUCT_SOURCE(None).find( 'TEST') bc = BCVideo.from_cms(cms) self.assertEqual('TEST', bc.data['custom_fields']['produkt-id'])
def test_converts_keywords(self): cms = CMSVideo() self.setup_tags('staatsanwaltschaft', 'parlament') bc = BCVideo.from_cms(cms) self.assertEqual('staatsanwaltschaft;parlament', bc.data['custom_fields']['cmskeywords'])
def test_looks_up_type_conversion_by_field(self): cms = CMSVideo() cms.commentsAllowed = True bc = BCVideo.from_cms(cms) self.assertEqual('1', bc.data['custom_fields']['allow_comments'])
def test_converts_advertisement(self): cms = CMSVideo() cms.has_advertisement = False bc = BCVideo.from_cms(cms) self.assertEqual('FREE', bc.data['economics'])