def test_authorships_should_be_copied_to_freetext_on_create(self): content = ExampleContentType() content.authorships = [ content.authorships.create(self.repository['author'])] zope.event.notify(ObjectCreatedEvent(content)) self.repository['foo'] = content self.assertEqual( ('William Shakespeare',), self.repository['foo'].authors)
def create_content(self, with_authors=False, **kw): """Create content with values given in arguments.""" from zeit.cms.testcontenttype.testcontenttype import ExampleContentType content = ExampleContentType() for key, value in kw.items(): setattr(content, key, value) if with_authors: shakespeare = zeit.content.author.author.Author() shakespeare.firstname = 'William' shakespeare.lastname = 'Shakespeare' shakespeare.enable_followpush = True bacon = zeit.content.author.author.Author() bacon.firstname = 'Francis' bacon.lastname = 'Bacon' self.repository['shakespeare'] = shakespeare self.repository['bacon'] = bacon shakespeare.enable_followpush = False content.authorships = [ content.authorships.create(self.repository['shakespeare']), content.authorships.create(self.repository['bacon']) ] self.repository['content'] = content return self.repository['content']