Пример #1
0
    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_test_file('data/test.zip', globals())
        manage_addNyPhotoGallery(self.portal.myfolder, id='mygallery2', title='My second photo gallery', submitted=1, contributor='contributor')
        manage_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'])
Пример #2
0
 def _add_gallery(self):
     """ Add and search gallery """
     manage_addNyPhotoGallery(self._portal().info, id='mygallery', title='Photo Gallery', lang='en')
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Photo Gallery'])
     for x in meta:
         if x.getLocalProperty('title', 'en') == 'Photo Gallery':
             return x
     return None
Пример #3
0
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     manage_addNyPhotoGallery(self.portal.myfolder, id='mygallery', title='My photo gallery', submitted=1, contributor='contributor')
     manage_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()
Пример #4
0
 def afterSetUp(self):
     from Products.Naaya.NyFolder import addNyFolder
     from Products.NaayaPhotoArchive.NyPhotoGallery import manage_addNyPhotoGallery
     from Products.NaayaPhotoArchive.NyPhotoFolder import manage_addNyPhotoFolder
     from Products.NaayaPhotoArchive.NyPhoto import addNyPhoto
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     manage_addNyPhotoGallery(self.portal.myfolder, id='g', title='My gallery', submitted=1, contributor='admin')
     manage_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()