Commit 2420fa5c authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

Fix format_supported selector to consider if a profile is simplified or not

parent 44879714e928
......@@ -157,7 +157,8 @@ class FormatSupportedPredicateTC(CubicWebTC):
predicate = export.format_supported()
with self.admin_access.web_request() as req:
transfer = req.create_entity('SEDAArchiveTransfer', title=u'Test widget')
transfer = req.create_entity('SEDAArchiveTransfer', title=u'Test widget',
simplified_profile=True)
req.cnx.commit()
for seda_version in ('2.0', '1.0', '0.2'):
......@@ -196,6 +197,14 @@ class FormatSupportedPredicateTC(CubicWebTC):
self.assertEqual(predicate(None, req, entity=transfer, version='1.0'),
0)
transfer.cw_set(simplified_profile=False)
req.cnx.commit() # will reset compat_list
self.assertEqual(predicate(None, req, entity=transfer, version='2.0'),
1)
self.assertEqual(predicate(None, req, entity=transfer, version='1.0'),
0)
class ArchiveTransferDiagnoseTabTC(CubicWebTC):
......@@ -212,7 +221,8 @@ class ArchiveTransferExportTC(CubicWebTC):
def test_selected_export_class(self):
with self.admin_access.web_request() as req:
transfer = req.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing')
transfer = req.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing',
simplified_profile=True)
unit, unit_alt, unit_alt_seq = create_archive_unit(transfer)
req.cnx.commit()
......
......@@ -31,6 +31,8 @@ def format_supported(cls, req, rset=None, entity=None, **kwargs):
if entity is None:
entity = rset.get_entity(0, 0)
version = getattr(cls, 'seda_version', kwargs.get('version', req.form.get('version', '2.0')))
if version != '2.0' and not entity.simplified_profile:
return 0
return int(('SEDA ' + version) in entity.formats_compat)
......
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