Exemplo n.º 1
0
 def test_main(self):
     """ Add, Find, Edit and Delete Naaya Geo Point """
     addNyGeoPoint(self._portal().info, id='doc1', title='doc1', lang='en',
         geo_location=Geo('13', '14', 'here!'))
     addNyGeoPoint(self._portal().info, id='doc1_fr', title='doc1_fr', lang='fr',
         geo_location=Geo('15', '16', 'there'))
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya GeoPoint'])
     
     #Get added NyGeoPoint
     for x in meta:
         if x.getLocalProperty('title', 'en') == 'doc1':
             meta = x
         if x.getLocalProperty('title', 'fr') == 'doc1_fr':
             meta_fr = x
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'doc1')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'doc1_fr')
     self.assertEqual(meta.geo_location, Geo('13', '14', 'here!'))
     
     #Change NyGeoPoint title
     meta.saveProperties(title='doc1_edited', lang='en', geo_location=Geo("123.01", "234.30"))
     meta_fr.saveProperties(title='doc1_fr_edited', lang='fr', geo_location=Geo("123.01", "234.30"))
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'doc1_edited')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'doc1_fr_edited')
     
     #delete NyGeoPoint
     self._portal().info.manage_delObjects([meta.getId(),])
     self._portal().info.manage_delObjects([meta_fr.getId(),])
     
     brains = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya GeoPoint'])
     self.assertEqual(len(brains), 0)
Exemplo n.º 2
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Geo Point """
        addNyGeoPoint(self._portal().info, id="doc1", title="doc1", lang="en", geo_location=Geo("13", "14", "here!"))
        addNyGeoPoint(
            self._portal().info, id="doc1_fr", title="doc1_fr", lang="fr", geo_location=Geo("15", "16", "there")
        )

        meta = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya GeoPoint"])

        # Get added NyGeoPoint
        for x in meta:
            if x.getLocalProperty("title", "en") == "doc1":
                meta = x
            if x.getLocalProperty("title", "fr") == "doc1_fr":
                meta_fr = x

        self.assertEqual(meta.getLocalProperty("title", "en"), "doc1")
        self.assertEqual(meta_fr.getLocalProperty("title", "fr"), "doc1_fr")
        self.assertEqual(meta.geo_location, Geo("13", "14", "here!"))

        # Change NyGeoPoint title
        meta.saveProperties(title="doc1_edited", lang="en", geo_location=Geo("123.01", "234.30"))
        meta_fr.saveProperties(title="doc1_fr_edited", lang="fr", geo_location=Geo("123.01", "234.30"))

        self.assertEqual(meta.getLocalProperty("title", "en"), "doc1_edited")
        self.assertEqual(meta_fr.getLocalProperty("title", "fr"), "doc1_fr_edited")

        # delete NyGeoPoint
        self._portal().info.manage_delObjects([meta.getId()])
        self._portal().info.manage_delObjects([meta_fr.getId()])

        brains = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya GeoPoint"])
        self.assertEqual(len(brains), 0)
Exemplo n.º 3
0
 def afterSetUp(self):
     self.portal.manage_install_pluggableitem('Naaya GeoPoint')
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.geopoint.geopoint_item import addNyGeoPoint
     addNyFolder(self.portal, 'myfolder', contributor='contributor', submitted=1)
     self.portal.myfolder.folder_meta_types.append('Naaya GeoPoint')
     addNyGeoPoint(self.portal.myfolder, id='mygeopoint', title='My geopoint',
         submitted=1, contributor='contributor', geo_location=Geo('13', '13'))
     import transaction; transaction.commit()
Exemplo n.º 4
0
 def afterSetUp(self):
     self.portal.manage_install_pluggableitem('Naaya GeoPoint')
     from naaya.content.geopoint.geopoint_item import addNyGeoPoint
     addNyGeoPoint(self.portal.info,
                   id='ver_geopoint',
                   title='ver_geopoint',
                   submitted=1,
                   geo_location=Geo('13', '13'))
     import transaction
     transaction.commit()
Exemplo n.º 5
0
 def afterSetUp(self):
     self.portal.manage_install_pluggableitem('Naaya GeoPoint')
     from Products.Naaya.NyFolder import addNyFolder
     from naaya.content.geopoint.geopoint_item import addNyGeoPoint
     addNyFolder(self.portal,
                 'myfolder',
                 contributor='contributor',
                 submitted=1)
     FolderMetaTypes(self.portal.myfolder).add('Naaya GeoPoint')
     addNyGeoPoint(self.portal.myfolder,
                   id='mygeopoint',
                   title='My geopoint',
                   submitted=1,
                   contributor='contributor',
                   geo_location=Geo('13', '13'))
     import transaction
     transaction.commit()
Exemplo n.º 6
0
 def add_object(self, parent):
     parent.getSite().manage_install_pluggableitem('Naaya GeoPoint')
     kwargs = {'title': 'My geopoint', 'geo_location': Geo('13', '13')}
     ob = parent[addNyGeoPoint(parent, **kwargs)]
     ob.approveThis()
     return ob
Exemplo n.º 7
0
 def afterSetUp(self):
     self.portal.manage_install_pluggableitem('Naaya GeoPoint')
     from naaya.content.geopoint.geopoint_item import addNyGeoPoint
     addNyGeoPoint(self.portal.info, id='ver_geopoint', title='ver_geopoint',
         submitted=1, geo_location=Geo('13', '13'))
     import transaction; transaction.commit()
Exemplo n.º 8
0
 def afterSetUp(self):
     portal = self.app.portal
     portal.manage_install_pluggableitem("Naaya GeoPoint")
     addNyFolder(portal, "test_folder")
     addNyGeoPoint(portal.test_folder, id="test_point", title="test_point", geo_location=Geo("13", "13"))
Exemplo n.º 9
0
 def add_object(self, parent):
     parent.getSite().manage_install_pluggableitem('Naaya GeoPoint')
     kwargs = {'title': 'My geopoint', 'geo_location': Geo('13', '13')}
     ob = parent[addNyGeoPoint(parent, **kwargs)]
     ob.approveThis()
     return ob