def test_edit_project(self): self.login('user1') self.portal.invokeFactory('PloneSoftwareCenter', 'psc') psc = self.portal.psc # making sure the project is correctly set self.login('user2') form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'home_page': 'UNKNOWN', 'download_url': 'UNKNOWN', 'summary': 'The summary', 'author_email': '*****@*****.**', 'version': '0.1.0dev-r6983', 'platform': 'UNKNOWN', 'keywords': '', 'classifiers': ['Programming Language :: Python', 'Topic :: Utilities', 'Rated :: PG13'], 'description': 'xxx'} view = PyPIView(psc, Req(form)) view.submit() iw_dist = psc['iw.dist'] self.assertEquals(iw_dist.getText(), '<p>xxx</p>\n') form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'version': '0.1.0dev-r6983'} view = PyPIView(psc, Req(form)) view.submit() self.assertEquals(iw_dist.getText(), '<p>xxx</p>\n')
def test_distutils_id_missing2(self): # let's create a PSC with a project that # has the same name but no distutils fixed self.login('user1') self.portal.invokeFactory('PloneSoftwareCenter', 'psc') psc = self.portal.psc psc.invokeFactory('PSCProject', 'iw.dist') self.assertEquals(['iw.dist'], list(psc.objectIds())) psc['iw.dist'].setDistutilsMainId('another.one') # making sure the project is correctly set form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'home_page': 'UNKNOWN', 'download_url': 'UNKNOWN', 'summary': 'The summary', 'author_email': '*****@*****.**', 'version': '0.1.0dev-r6983', 'platform': 'UNKNOWN', 'keywords': '', 'classifiers': ['Programming Language :: Python', 'Topic :: Utilities', 'Rated :: PG13'], 'description': 'xxx'} view = PyPIView(psc, Req(form)) view.submit() iw_dist = psc['iw.dist'] self.assertEquals(iw_dist.getDistutilsSecondaryIds(), ('iw.dist',))
def test_unexisting_classifier(self): # make sure the server doesn't fail on unexisting # classifiers self.login('user1') self.portal.invokeFactory('PloneSoftwareCenter', 'psc') psc = self.portal.psc # making sure the project is correctly set self.login('user2') form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'home_page': 'UNKNOWN', 'download_url': 'UNKNOWN', 'summary': 'The summary', 'author_email': '*****@*****.**', 'version': '0.1.0dev-r6983', 'platform': 'UNKNOWN', 'keywords': '', 'classifiers': ['Programming Language :: Python', 'Topic :: Utilities', 'Rated :: PG13', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'], 'description': 'xxx'} view = PyPIView(psc, Req(form)) # adding a field psc = self.portal.psc pg = 'rated-pg13|Rated PG13|Rated :: PG13' classifiers = psc.getField('availableClassifiers') values = classifiers.get(psc) classifiers.set(psc, values + (pg,)) view.submit() iw_dist = psc['iw.dist'] wanted = ('python', 'utilities', 'rated-pg13') self.assertEquals(iw_dist.getClassifiers(), wanted)
def test_unexisting_classifier(self): # make sure the server doesn't fail on unexisting # classifiers self.login('user1') self.portal.invokeFactory('PloneSoftwareCenter', 'psc') psc = self.portal.psc # making sure the project is correctly set self.login('user2') form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'home_page': 'UNKNOWN', 'download_url': 'UNKNOWN', 'summary': 'The summary', 'author_email': '*****@*****.**', 'version': '0.1.0dev-r6983', 'platform': 'UNKNOWN', 'keywords': '', 'classifiers': ['Programming Language :: Python', 'Topic :: Utilities', 'Rated :: PG13', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'], 'description': 'xxx'} view = PyPIView(psc, Req(form)) # adding a field psc = self.portal.psc pg = 'rated-pg13|Rated PG13|Rated :: PG13' classifiers = psc.getField('availableClassifiers') values = classifiers.get(classifiers) classifiers.set(psc, values + (pg,)) view.submit() iw_dist = psc['iw.dist'] wanted = ('python', 'utilities', 'rated-pg13') self.assertEquals(iw_dist.getClassifiers(), wanted)
def createProductWithName(name): view = PyPIView( psc, Req({ '': 'submit', 'name': name, 'version': '1.0' })) view.submit()
def createProductWithNameAndVersion(name, version): view = PyPIView( psc, Req({ '': 'submit', 'name': name, 'version': version })) view.submit() return psc[name].releases[version]
def testSubmit(self): self.login('user1') self.portal.invokeFactory('PloneSoftwareCenter', 'psc') psc = self.portal.psc # a user can submit a package # that creates a project and a release folder, to hold # release infos. # no links or file links are created # until the project is published by the PSC owner self.login('user2') form = {'': 'submit', 'license': 'GPL', 'name': 'iw.dist', 'metadata_version': '1.0', 'author': 'Ingeniweb', 'home_page': 'UNKNOWN', 'download_url': 'UNKNOWN', 'summary': 'xxx', 'author_email': '*****@*****.**', 'version': '0.1.0dev-r6983', 'platform': 'UNKNOWN', 'keywords': '', 'classifiers': ['Programming Language :: Python', 'Topic :: Utilities', 'Rated :: PG13'], 'description': 'xxx'} view = PyPIView(psc, Req(form)) view.submit() # check what has been created iw_dist = psc['iw.dist'] rel = iw_dist.releases['0.1.0dev-r6983'] # we don't want any file or file link self.assertEquals(rel.objectIds(), []) view.submit() # check what has been created iw_dist = psc['iw.dist'] rel = iw_dist.releases['0.1.0dev-r6983'] # we don't want any file or file link self.assertEquals(rel.objectIds(), []) # now let's provide an url form['download_url'] = 'the_url' form['platform'] = 'win32' view = PyPIView(psc, Req(form)) view.submit() self.assertEquals(rel.objectIds(), ['download']) # now let the user 1 publish the project self.login('user1') wf = self.portal.portal_workflow wf.doActionFor(iw_dist, 'publish')
def createProductWithNameAndVersion(name, version): view = PyPIView(psc, Req({'': 'submit', 'name': name, 'version': version})) view.submit() return psc[name].releases[version]
def createProductWithName(name): view = PyPIView(psc, Req({'': 'submit', 'name': name, 'version': '1.0'})) view.submit()