Commit bcb89bd6 authored by Romain Courteaud's avatar Romain Courteaud

slapos_slap_tool: Release

parent de437360
...@@ -2299,27 +2299,19 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2299,27 +2299,19 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
new_id = self.generateNewId() new_id = self.generateNewId()
software_product = self._makeSoftwareProduct(self.project, new_id=new_id) software_product = self._makeSoftwareProduct(self.project, new_id=new_id)
# 2 published software releases # 2 published software releases
software_release1 = self._makeSoftwareRelease(software_product) software_release1 = self._makeSoftwareRelease(software_product, url='http://example.org/1.cfg')
software_release2 = self._makeSoftwareRelease(software_product) software_release2 = self._makeSoftwareRelease(software_product, url='http://example.org/2.cfg')
software_release1.publish() software_release1.publish()
software_release2.publish() software_release2.publish()
# 1 released software release, should not appear # 1 released software release, should not appear
software_release3 = self._makeSoftwareRelease(software_product) software_release3 = self._makeSoftwareRelease(software_product, url='http://example.org/3.cfg')
self.assertTrue(software_release3.getValidationState() == 'released') self.assertTrue(software_release3.getValidationState() == 'released')
software_release1.edit( software_release1.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/1.cfg',
effective_date=DateTime() effective_date=DateTime()
) )
software_release2.edit( software_release2.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/2.cfg',
effective_date=DateTime() effective_date=DateTime()
) )
software_release3.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/3.cfg'
)
self.tic() self.tic()
response = self.portal_slap.getSoftwareReleaseListFromSoftwareProduct( response = self.portal_slap.getSoftwareReleaseListFromSoftwareProduct(
...@@ -2342,26 +2334,17 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2342,26 +2334,17 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
new_id = self.generateNewId() new_id = self.generateNewId()
software_product = self._makeSoftwareProduct(self.project, new_id=new_id) software_product = self._makeSoftwareProduct(self.project, new_id=new_id)
# 3 published software releases # 3 published software releases
software_release1 = self._makeSoftwareRelease(software_product) software_release1 = self._makeSoftwareRelease(software_product, url='http://example.org/1.cfg')
software_release2 = self._makeSoftwareRelease(software_product) software_release2 = self._makeSoftwareRelease(software_product, url='http://example.org/2.cfg')
software_release3 = self._makeSoftwareRelease(software_product) software_release3 = self._makeSoftwareRelease(software_product, url='http://example.org/3.cfg')
software_release1.publish()
software_release2.publish()
software_release3.publish()
software_release1.edit( software_release1.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/1.cfg',
effective_date=(DateTime() - 1) effective_date=(DateTime() - 1)
) )
# Should not be considered yet! # Should not be considered yet!
software_release2.edit( software_release2.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/2.cfg',
effective_date=(DateTime() + 1) effective_date=(DateTime() + 1)
) )
software_release3.edit( software_release3.edit(
aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/3.cfg',
effective_date=DateTime() effective_date=DateTime()
) )
self.tic() self.tic()
...@@ -2422,8 +2405,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2422,8 +2405,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
# 2 published software releases # 2 published software releases
software_release1 = self._makeSoftwareRelease(software_product) software_release1 = self._makeSoftwareRelease(software_product)
software_release2 = self._makeSoftwareRelease(software_product) software_release2 = self._makeSoftwareRelease(software_product)
software_release1.publish()
software_release2.publish()
# 1 released software release, should not appear # 1 released software release, should not appear
software_release3 = self._makeSoftwareRelease(software_product) software_release3 = self._makeSoftwareRelease(software_product)
self.assertTrue(software_release3.getValidationState() == 'released') self.assertTrue(software_release3.getValidationState() == 'released')
......
...@@ -386,7 +386,7 @@ class SlapTool(BaseTool): ...@@ -386,7 +386,7 @@ class SlapTool(BaseTool):
if software_product_reference is None: if software_product_reference is None:
assert(software_release_url is not None) assert(software_release_url is not None)
software_product_reference = self.getPortalObject().portal_catalog.unrestrictedSearchResults( software_product_reference = self.getPortalObject().portal_catalog.unrestrictedSearchResults(
portal_type='Software Release', portal_type='Software Product Release Variation',
url_string=software_release_url url_string=software_release_url
)[0].getObject().getAggregateValue().getReference() )[0].getObject().getAggregateValue().getReference()
else: else:
...@@ -402,7 +402,7 @@ class SlapTool(BaseTool): ...@@ -402,7 +402,7 @@ class SlapTool(BaseTool):
if len(software_product_list) > 1: if len(software_product_list) > 1:
raise NotImplementedError('Several Software Product with the same title.') raise NotImplementedError('Several Software Product with the same title.')
software_release_list = \ software_release_list = \
software_product_list[0].getObject().getAggregateRelatedValueList() software_product_list[0].getObject().contentValues(portal_type='Software Product Release Variation')
def sortkey(software_release): def sortkey(software_release):
publication_date = software_release.getEffectiveDate() publication_date = software_release.getEffectiveDate()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment