Exemple #1
0
 def test_main(self):
     """ Add, Find, Edit and Delete Naaya Stories """
     #add NyStory
     addNyStory(self._portal().info, id='story1', title='story1', lang='en', submitted=1)
     addNyStory(self._portal().info, id='story1_fr', title='story1_fr', lang='fr', submitted=1)
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Story'])
     
     #get added NyStory
     for x in meta:
         if x.getLocalProperty('title', 'en') == 'story1':
             meta = x
         if x.getLocalProperty('title', 'fr') == 'story1_fr':
             meta_fr = x
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'story1')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'story1_fr')
     
     #change NyStory title
     meta.saveProperties(title='story1_edited', lang='en')
     meta_fr.saveProperties(title='story1_fr_edited', lang='fr')
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'story1_edited')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'story1_fr_edited')
     
     #delete NyStory
     self._portal().info.manage_delObjects([meta.id])
     self._portal().info.manage_delObjects([meta_fr.id])
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Story'])
     self.assertEqual(meta, [])
 def afterSetUp(self):
     from naaya.content.story.story_item import addNyStory
     addNyStory(self.portal.info,
                id='ver_story',
                title='ver_story',
                submitted=1)
     import transaction
     transaction.commit()
 def test_export_story(self):
     addNyStory(self.test_folder, id="a_nice_story")
     self.test_folder["a_nice_story"].body = "<p>A nice story</p>"
     self.test_folder["a_nice_story"].approved = 1
     export_value = self.test_folder.zip_export.do_export()
     zip = ZipFile(export_value, "r")
     self.assertEqual(sorted(zip.namelist()), sorted(["index.txt", "zip_export_folder/a_nice_story.html"]))
     self.assertEqual(zip.read("zip_export_folder/a_nice_story.html"), "<p>A nice story</p>")
Exemple #4
0
 def test_export_story(self):
     addNyStory(self.test_folder, id='a_nice_story')
     self.test_folder['a_nice_story'].body = '<p>A nice story</p>'
     self.test_folder['a_nice_story'].approved = 1
     export_value = self.test_folder.zip_export.do_export()
     zip = ZipFile(export_value, 'r')
     self.assertEqual(sorted(zip.namelist()),
                      sorted(['index.txt',
                              'zip_export_folder/a_nice_story.html']))
     self.assertEqual(zip.read('zip_export_folder/a_nice_story.html'),
                               '<p>A nice story</p>')
 def test_export_story(self):
     addNyStory(self.test_folder, id='a_nice_story')
     self.test_folder['a_nice_story'].body = '<p>A nice story</p>'
     self.test_folder['a_nice_story'].approved = 1
     export_value = self.test_folder.zip_export.do_export()
     zip = ZipFile(export_value, 'r')
     self.assertEqual(
         sorted(zip.namelist()),
         sorted(['index.txt', 'zip_export_folder/a_nice_story.html']))
     self.assertEqual(zip.read('zip_export_folder/a_nice_story.html'),
                      '<p>A nice story</p>')
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.story.story_item import addNyStory
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     addNyStory(self.portal.myfolder,
                id='mystory',
                title='My story',
                submitted=1,
                contributor='contributor')
     import transaction
     transaction.commit()
    def test_syndication(self):
        self.portal.publisher = "The publisher"
        self.portal.creator = "The creator"
        addNyStory(self.portal["info"], id="9000", title="The story")
        story = self.portal["info"]["9000"]
        tree = etree.XML(story.syndicateThis())
        story_type = tree.xpath("./dc:type", namespaces=rdf_ns_map)[0]
        story_format = tree.xpath("./dc:format", namespaces=rdf_ns_map)[0]
        story_source = tree.xpath("./dc:source", namespaces=rdf_ns_map)[0]
        story_creator = tree.xpath("./dc:creator", namespaces=rdf_ns_map)[0]
        story_publisher = tree.xpath("./dc:publisher", namespaces=rdf_ns_map)[0]

        self.assertEqual(story_type.text, "Text")
        self.assertEqual(story_format.text, "text")
        self.assertEqual(story_source.text, self.portal.publisher)
        self.assertEqual(story_creator.text, self.portal.creator)
        self.assertEqual(story_publisher.text, self.portal.publisher)
Exemple #8
0
    def test_syndication(self):
        self.portal.publisher = 'The publisher'
        self.portal.creator = 'The creator'
        addNyStory(self.portal['info'], id='9000', title='The story')
        story = self.portal['info']['9000']
        tree = etree.XML(story.syndicateThis())
        story_type = tree.xpath('./dc:type', namespaces=rdf_ns_map)[0]
        story_format = tree.xpath('./dc:format', namespaces=rdf_ns_map)[0]
        story_source = tree.xpath('./dc:source', namespaces=rdf_ns_map)[0]
        story_creator = tree.xpath('./dc:creator', namespaces=rdf_ns_map)[0]
        story_publisher = tree.xpath('./dc:publisher',
                                     namespaces=rdf_ns_map)[0]

        self.assertEqual(story_type.text, 'Text')
        self.assertEqual(story_format.text, 'text')
        self.assertEqual(story_source.text, self.portal.publisher)
        self.assertEqual(story_creator.text, self.portal.creator)
        self.assertEqual(story_publisher.text, self.portal.publisher)
Exemple #9
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Stories """
        #add NyStory
        addNyStory(self._portal().info,
                   id='story1',
                   title='story1',
                   lang='en',
                   submitted=1)
        addNyStory(self._portal().info,
                   id='story1_fr',
                   title='story1_fr',
                   lang='fr',
                   submitted=1)

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Story'])

        #get added NyStory
        for x in meta:
            if x.getLocalProperty('title', 'en') == 'story1':
                meta = x
            if x.getLocalProperty('title', 'fr') == 'story1_fr':
                meta_fr = x

        self.assertEqual(meta.getLocalProperty('title', 'en'), 'story1')
        self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'story1_fr')

        #change NyStory title
        meta.saveProperties(title='story1_edited', lang='en')
        meta_fr.saveProperties(title='story1_fr_edited', lang='fr')

        self.assertEqual(meta.getLocalProperty('title', 'en'), 'story1_edited')
        self.assertEqual(meta_fr.getLocalProperty('title', 'fr'),
                         'story1_fr_edited')

        #delete NyStory
        self._portal().info.manage_delObjects([meta.id])
        self._portal().info.manage_delObjects([meta_fr.id])

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Story'])
        self.assertEqual(meta, [])
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.story.story_item import addNyStory
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyStory(self.portal.myfolder, id='mystory', title='My story', submitted=1, contributor='contributor')
     import transaction; transaction.commit()
 def afterSetUp(self):
     from naaya.content.story.story_item import addNyStory
     addNyStory(self.portal.info, id='ver_story', title='ver_story', submitted=1)
     import transaction; transaction.commit()
Exemple #12
0
 def add_object(self, parent):
     ob = parent[addNyStory(parent, title='My story', submitted=1)]
     ob.approveThis()
     return ob
 def add_object(self, parent, **kwargs):
     from naaya.content.story.story_item import addNyStory
     return addNyStory(parent, **kwargs)
 def add_object(self, parent):
     ob = parent[addNyStory(parent, title='My story', submitted=1)]
     ob.approveThis()
     return ob