Esempio n. 1
0
 def copied_to_library_url(self):
     try:
         publish_adapter = IPublishWidely(self.context)
     except TypeError:
         return False
     target = publish_adapter.target()
     return target and target.absolute_url() or None
Esempio n. 2
0
 def test_workflow_noworkflow(self):
     content = api.content.create(
         type='Image',
         title='Holidays previous year image',
         container=self.source_folder)
     adapted = IPublishWidely(content)
     self.assertTrue(adapted.can_publish_widely())
Esempio n. 3
0
 def test_location(self):
     content = api.content.create(
         type='Document',
         title='Library document',
         container=self.library_folder)
     api.content.transition(content, 'publish')
     adapted = IPublishWidely(content)
     self.assertFalse(adapted.can_publish_widely())
Esempio n. 4
0
 def test_behavior_active_image(self):
     content = api.content.create(
         type='Image',
         title='Holidays previous year image',
         container=self.source_folder)
     self.assertFalse(IPublishWidely.providedBy(content))
     adapted = IPublishWidely(content)
     self.assertTrue(IPublishWidely.providedBy(adapted))
Esempio n. 5
0
 def test_behavior_active_link(self):
     content = api.content.create(
         type='Link',
         title='Holidays previous year link',
         container=self.source_folder)
     api.content.transition(content, 'publish')
     self.assertFalse(IPublishWidely.providedBy(content))
     adapted = IPublishWidely(content)
     self.assertTrue(IPublishWidely.providedBy(adapted))
Esempio n. 6
0
 def test_relation_source(self):
     adapted = IPublishWidely(self.source_document)
     self.assertEquals(adapted.source(), None)
     new = adapted.copy_to(self.library_folder)
     new_adapted = IPublishWidely(new)
     self.assertEquals(new_adapted.source(), self.source_document)
     self.assertNotEquals(new_adapted.source(), None)
Esempio n. 7
0
 def can_publish_widely(self):
     try:
         return IPublishWidely(self.context).can_publish_widely()
     except TypeError:
         return False
Esempio n. 8
0
 def test_workflow(self):
     adapted = IPublishWidely(self.source_document)
     self.assertTrue(adapted.can_publish_widely())
     api.content.transition(self.source_document, 'retract')
     self.assertFalse(adapted.can_publish_widely())
Esempio n. 9
0
 def test_permission(self):
     adapted = IPublishWidely(self.source_document)
     self.assertTrue(adapted.can_publish_widely())
     setRoles(self.portal, TEST_USER_ID, ('Member',))
     self.assertFalse(adapted.can_publish_widely())
Esempio n. 10
0
 def test_behavior_active_document(self):
     content = self.source_document
     self.assertFalse(IPublishWidely.providedBy(content))
     adapted = IPublishWidely(content)
     self.assertTrue(IPublishWidely.providedBy(adapted))
Esempio n. 11
0
 def test_behavior_interface(self):
     adapted = IPublishWidely(self.source_document)
     self.assertTrue(verifyObject(IPublishWidely, adapted))
Esempio n. 12
0
 def test_publish_only_once(self):
     adapted = IPublishWidely(self.source_document)
     self.assertTrue(adapted.can_publish_widely())
     adapted.copy_to(self.library_folder)
     self.assertFalse(adapted.can_publish_widely())
Esempio n. 13
0
 def test_copy_to(self):
     adapted = IPublishWidely(self.source_document)
     new = adapted.copy_to(self.library_folder)
     self.assertIn(new, self.library_folder.objectValues())
     self.assertEquals(new.title, self.source_document.title)
Esempio n. 14
0
 def test_copy_to_target(self):
     adapted = IPublishWidely(self.source_document)
     new = adapted.copy_to(self.library_section)  # invalid target
     self.assertEquals(None, new)