def testNonLicensableTopic(self): from collective.contentlicensing.browser import CopyrightBylineView self.setRoles(['Manager']) self.portal.invokeFactory('Folder', 'folder1') folder1 = getattr(self.portal, 'folder1') folder1.setTitle('Test Folder 01') folder1.invokeFactory('Document', 'doc1') doc1 = getattr(folder1, 'doc1') doc1.setTitle('Test Document 01') doc1.setCreators( 'Piotr Tchaikovsky\nWinter Daydreams\nLon Pathetique\nGuido Van Rossum' ) doc1.setText('lorem ipsum blah blah blah') folder1.invokeFactory('Topic', 'sf1') sf1 = getattr(folder1, 'sf1') sf1.setTitle('Test Smart Folder 01') sf1.setDescription('This is a test Smart Folder') view = CopyrightBylineView(doc1, self.app.REQUEST) assert (view.getLicenseByline()) view = CopyrightBylineView(doc1, self.app.REQUEST) self.assertRaises(TypeError, view.getLicenseByline())
def testOneNameAuthorCitation(self): from collective.contentlicensing.browser import CopyrightBylineView self.setRoles(['Manager']) self.portal.invokeFactory('Document','doc1') doc1 = getattr(self.portal,'doc1') doc1.setTitle('Test Course 04') doc1.setCreators('Rossum') view = CopyrightBylineView(doc1,self.app.REQUEST) info = view.getCitationInfo() assert (info.find('Rossum. (') == 0) assert (info.find('Test Course 04') > -1) assert (info.find('http://nohost/plone/doc1') > -1)
def testThreeAuthorCitation(self): from collective.contentlicensing.browser import CopyrightBylineView self.setRoles(['Manager']) self.portal.invokeFactory('Document','doc1') doc1 = getattr(self.portal,'doc1') doc1.setTitle('Test Course 04') doc1.setCreators('Piotr Tchaikovsky\nWinter Daydreams\nLon Pathetique\nGuido Van Rossum') view = CopyrightBylineView(doc1,self.app.REQUEST) info = view.getCitationInfo() assert (info.find('Tchaikovsky, P., Daydreams, W., Pathetique, L., Rossum, G. V. (') == 0) assert (info.find('Test Course 04') > -1) assert (info.find('http://nohost/plone/doc1') > -1)