コード例 #1
0
ファイル: test_non_licensable.py プロジェクト: dtgit/ecec
    def testNonLicensableTopic(self):
        from Products.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())
コード例 #2
0
ファイル: test_cite_resource.py プロジェクト: dtgit/dtedu
 def testOneNameAuthorCitation(self):
     from Products.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)
コード例 #3
0
ファイル: test_cite_resource.py プロジェクト: dtgit/dtedu
 def testThreeAuthorCitation(self):
     from Products.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)