[PATCH 07 of 13 saem_ref] [seda] Ensure URLs generated for different SEDA versions are consistent

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 31 17:57:19 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490888010 -7200
#      Thu Mar 30 17:33:30 2017 +0200
# Node ID 0085787efc555d0f99e2fbdace6f42e2aea828c6
# Parent  85982216f0b9c4d28573bbbd4fcef44c1324ac8e
[seda] Ensure URLs generated for different SEDA versions are consistent

Related to extranet #15934739

diff --git a/cubicweb_saem_ref/entities/seda.py b/cubicweb_saem_ref/entities/seda.py
--- a/cubicweb_saem_ref/entities/seda.py
+++ b/cubicweb_saem_ref/entities/seda.py
@@ -22,18 +22,18 @@ from cubicweb.predicates import is_insta
 
 from cubes.oaipmh import MetadataFormat
 from cubes.oaipmh.entities import OAISetSpec
 from cubicweb_seda.entities import SEDAArchiveTransferIClonableAdapter
 from cubicweb_seda.entities.custom import SEDAArchiveTransfer
-from cubicweb_seda.entities.profile_generation import SEDA1XSDExport
+from cubicweb_seda.entities.profile_generation import SEDA2ExportAdapter, SEDA1XSDExport
 from cubicweb_seda.views import export
 
 from .. import cwuri_url
 from . import oai
 
 
-SEDA1XSDExport.cwuri_url = staticmethod(cwuri_url)
+SEDA2ExportAdapter.cwuri_url = staticmethod(cwuri_url)
 
 
 # hijack xsd_archival_agreement to insert profile as well. Use a monkey-patch rather than new
 # implementation to avoid doing it twice, once for SEDA 1 another for SEDA 0.2
 
diff --git a/test/test_seda.py b/test/test_seda.py
--- a/test/test_seda.py
+++ b/test/test_seda.py
@@ -17,11 +17,11 @@
 
 import unittest
 
 from cubicweb.devtools.testlib import CubicWebTC
 
-from cubicweb_seda.entities.profile_generation import SEDA1XSDExport
+from cubicweb_seda.entities.profile_generation import SEDA1XSDExport, SEDA2RelaxNGExport
 
 from cubicweb_saem_ref.entities import seda  # noqa - trigger monkey-patch
 
 import testutils
 
@@ -45,10 +45,19 @@ class CWURIURLTC(unittest.TestCase):
         self.assertEqual(SEDA1XSDExport.cwuri_url(FakeEntity('http://othertest/whatever')),
                          'http://othertest/whatever')
         self.assertEqual(SEDA1XSDExport.cwuri_url(FakeEntity('whatever')),
                          'whatever')
 
+        self.assertEqual(SEDA2RelaxNGExport.cwuri_url(FakeEntity('ark:12/3')),
+                         'http://thistest/ark:12/3')
+        self.assertEqual(SEDA2RelaxNGExport.cwuri_url(FakeEntity('http://othertest/ark:12/3')),
+                         'http://othertest/ark:12/3')
+        self.assertEqual(SEDA2RelaxNGExport.cwuri_url(FakeEntity('http://othertest/whatever')),
+                         'http://othertest/whatever')
+        self.assertEqual(SEDA2RelaxNGExport.cwuri_url(FakeEntity('whatever')),
+                         'whatever')
+
 
 class SEDAExportTC(CubicWebTC):
 
     def test_include_profile_ark(self):
         with self.admin_access.client_cnx() as cnx:


More information about the saem-devel mailing list