def test_cut_paste(self):
        return #TODO: cannot paste from the test; some photos are not correctly pasted (d and d, e-34, and pasting when id exists)
        photos_zip = load_file('data/test.zip')
        addNyPhotoGallery(self.portal.myfolder, id='mygallery2', title='My second photo gallery', submitted=1, contributor='contributor')
        addNyPhotoFolder(self.portal.myfolder.mygallery2, id='myalbum', title='My photo album')
        self.portal.myfolder.mygallery2.myalbum.uploadPhotoOrZip(photos_zip)
        import transaction; transaction.commit()

        album_source = self.portal.myfolder.mygallery2.myalbum
        album_destination = self.portal.myfolder.mygallery.myalbum
        pics = [
            {'zip': 'a.gif' , 'portal': 'a.gif'},
            {'zip': 'b.gif' , 'portal': 'b.gif'},
            {'zip': 'c-d.gif' , 'portal': 'c-d.gif'},
            {'zip': 'd and d.gif' , 'portal': 'd_and_d.gif'},
            {'zip': 'e-34.gif' , 'portal': 'e-34.gif'},
            {'zip': 'k.gif' , 'portal': 'k.gif'},
        ]

        photos_zip = zipfile.ZipFile(photos_zip)

        paste_data = album_source.cutObjects(ids=[pic['portal'] for pic in pics])
        album_destination.pasteObjects(cp_data=paste_data)

        for pic in pics:
            self.failIf(pic['portal'] not in album_destination.objectIds(), '%s not in destination.' % pic['portal'])
            self.browser.go('http://localhost/%s/%s/view?display=Original' % (album_destination.absolute_url(1), pic['portal']))
            self.failUnlessEqual(photos_zip.read(pic['zip']), self.browser.get_html(), '%s contents doesn\'t match original.' % pic['portal'])
Esempio n. 2
0
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
     from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
     from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     addNyPhotoGallery(self.portal.myfolder,
                       id='g',
                       title='My gallery',
                       submitted=1,
                       contributor='admin')
     addNyPhotoFolder(self.portal.myfolder.g,
                      id='f',
                      title='My folder',
                      submitted=1,
                      contributor='admin')
     addNyPhoto(self.portal.myfolder.g.f,
                id='myphoto',
                title='My photo',
                submitted=1,
                contributor='contributor')
     import transaction
     transaction.commit()
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyPhotoGallery(self.portal.myfolder, id='mygallery', title='My photo gallery', submitted=1, contributor='contributor')
     addNyPhotoFolder(self.portal.myfolder.mygallery, id='myalbum', title='My photo album')
     addNyPhoto(self.portal.myfolder.mygallery.myalbum, id="myphoto1", title="My photo 1")
     addNyPhoto(self.portal.myfolder.mygallery.myalbum, id="myphoto2", title="My photo 2")
     self.portal.myfolder.approveThis()
     import transaction; transaction.commit()
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
     from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
     from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     addNyPhotoGallery(self.portal.myfolder, id='g', title='My gallery', submitted=1, contributor='admin')
     addNyPhotoFolder(self.portal.myfolder.g, id='f', title='My folder', submitted=1, contributor='admin')
     addNyPhoto(self.portal.myfolder.g.f, id='myphoto', title='My photo', submitted=1, contributor='contributor')
     import transaction; transaction.commit()
     transaction.commit()
    def afterSetUp(self):
        from Products.Naaya.NyFolder import addNyFolder
        from Products.NaayaPhotoArchive.NyPhotoGallery import addNyPhotoGallery
        from Products.NaayaPhotoArchive.NyPhotoFolder import addNyPhotoFolder
        from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto

        addNyFolder(self.portal, "myfolder", contributor="contributor", submitted=1)
        addNyPhotoGallery(self.portal.myfolder, id="g", title="My gallery", submitted=1, contributor="admin")
        addNyPhotoFolder(self.portal.myfolder.g, id="f", title="My folder", submitted=1, contributor="admin")
        addNyPhoto(self.portal.myfolder.g.f, id="myphoto", title="My photo", submitted=1, contributor="contributor")
        import transaction

        transaction.commit()
Esempio n. 6
0
 def add_object(self, parent):
     kwargs = {
         'id': 'myfolder',
         'title': 'My photo folder',
         'submitted': 1,
         'contributor': 'contributor',
         'start_date': "10/10/2000",
     }
     ob = parent[addNyPhotoFolder(parent, **kwargs)]
     ob.approveThis()
     return ob
Esempio n. 7
0
 def add_object(self, parent):
     kwargs = {
         'id': 'myfolder',
         'title': 'My photo folder',
         'submitted': 1,
         'contributor': 'contributor',
         'start_date': "10/10/2000",
     }
     ob = parent[addNyPhotoFolder(parent, **kwargs)]
     ob.approveThis()
     return ob