[test/cleanup] Use .cnx instead of (repo/client)_cnx
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 11 Apr 2017 15:19:39 +0200
changeset 2613 71f04ef316cb
parent 2612 9220e0ebf255
child 2614 964d1e0db292
[test/cleanup] Use .cnx instead of (repo/client)_cnx
test/test_dataimport.py
test/test_diag.py
test/test_entities.py
test/test_hooks.py
test/test_html_generation.py
test/test_profile_generation.py
test/test_schema.py
test/test_views.py
--- a/test/test_dataimport.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_dataimport.py	Tue Apr 11 15:19:39 2017 +0200
@@ -23,7 +23,7 @@
 class ConcepSchemeImportTC(CubicWebTC):
 
     def test_import_seda_schemes(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             dataimport.import_seda_schemes(cnx, lcsv_import=dataimport.lcsv_check)
             self.assertEqual(len(cnx.find('ConceptScheme')), 18)
 
--- a/test/test_diag.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_diag.py	Tue Apr 11 15:19:39 2017 +0200
@@ -23,7 +23,7 @@
 class CompatAnalyzerTC(CubicWebTC):
 
     def test_rules(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             transfer = create('SEDAArchiveTransfer', title=u'diagnosis testing')
@@ -79,7 +79,7 @@
                                   'rule_ref_non_rule_id')
 
     def test_custodial_history(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             transfer = create('SEDAArchiveTransfer', title=u'diagnosis testing')
@@ -115,7 +115,7 @@
                                   'seda02_custodial_history_when')
 
     def test_archive_unit_reference_in_transfer(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing')
             create_archive_unit(transfer, archive_unit_reference=True)
 
@@ -124,7 +124,7 @@
             self.assertDiagnostic(doctor, ['SEDA 2.0'], 'use_archive_unit_ref')
 
     def test_archive_unit_reference_in_archive_unit(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing')
             unit, unit_alt, unit_alt_seq = create_archive_unit(transfer)
             create_archive_unit(unit_alt_seq, archive_unit_reference=True)
--- a/test/test_entities.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_entities.py	Tue Apr 11 15:19:39 2017 +0200
@@ -52,7 +52,7 @@
         self.assertIsNone(entity.cw_adapt_to('IContained'))
 
     def test_container_relation(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
             transfer = create('SEDAArchiveTransfer', title=u'test profile')
             mtclv = create('SEDAMimeTypeCodeListVersion',
@@ -72,7 +72,7 @@
 
     def test_archive_unit_container_clone(self):
         """Functional test for SEDA component clone."""
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = create_archive_unit(None, cnx=cnx)
             bdo = create_data_object(unit_alt_seq)
             cnx.commit()
@@ -116,7 +116,7 @@
 
     def test_archive_transfer_clone(self):
         """Functional test for SEDA profile cloning."""
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             scheme = cnx.create_entity('ConceptScheme', title=u'Algorithms')
             concept = scheme.add_concept(u'md5')
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
@@ -140,7 +140,7 @@
 
     def test_container_clone_clone(self):
         """Functional test for SEDA component clone."""
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = create_archive_unit(None, cnx=cnx)
             cnx.commit()
 
@@ -222,7 +222,7 @@
         self.assertEqual(parent_eid, expected_eid)
 
     def test(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             au, alt, seq = create_archive_unit(transfer)
             do_ref = cnx.create_entity('SEDADataObjectReference',
@@ -300,13 +300,13 @@
 class CustomEntitiesTC(CubicWebTC):
 
     def test_title(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             for etype in ('SEDAArchiveUnit', 'SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
                 ent = cnx.create_entity(etype, user_annotation=u'bla bla\nbli bli blo\n')
                 self.assertEqual(ent.dc_title(), u'bla bla')
 
     def test_climb_rule_holders(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             unit, _, unit_alt_seq = create_archive_unit(transfer)
             subunit, _, subunit_alt_seq = create_archive_unit(unit_alt_seq)
--- a/test/test_hooks.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_hooks.py	Tue Apr 11 15:19:39 2017 +0200
@@ -27,7 +27,7 @@
     assertValidationError = testutils.assertValidationError
 
     def test_ref_non_rule_constraints(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             access_scheme = create('ConceptScheme', title=u'access')
@@ -61,7 +61,7 @@
 
     def test_empty_choice_created(self):
         """Check that a ValidationError is raised when an empty SEDAAlt... entity is created."""
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             # Create an empty SEDAAltAccessRulePreventInheritance
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=transfer)
@@ -73,7 +73,7 @@
 
     def test_valid_choice_created(self):
         """Check that everything goes fine when a valid SEDAAlt... entity is created."""
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             # Create an empty SEDAArchiveUnit
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=transfer)
@@ -87,7 +87,7 @@
         """Check that a ValidationError is raised when the last relation from a SEDAAlt... entity
         is deleted.
         """
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             # Create a valid SEDAAltAccessRulePreventInheritance
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=transfer)
@@ -107,7 +107,7 @@
         """Check that everything goes fine when the a relation from a SEDAAlt... entity
         is deleted but another relation remains.
         """
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             # Create a valid SEDAAltAccessRulePreventInheritance with two items
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=transfer)
@@ -126,7 +126,7 @@
 class SetDefaultHooksTC(CubicWebTC):
 
     def test_default_code_list_version(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             for rtype, etype in chain(zip(('seda_format_id_to', 'seda_mime_type_to',
                                            'seda_encoding_to'),
                                           repeat(None)),
@@ -152,7 +152,7 @@
         should always be 1 (by default any card is allowed since in may be used in the context of
         'main' reference).
         """
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
             version_of = cnx.create_entity('SEDAIsVersionOf', seda_is_version_of=unit_alt_seq)
@@ -168,7 +168,7 @@
         specifies user_cardinality for it, not for it's associated reference whose cardinality
         should have the same value.
         """
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile',
                                          simplified_profile=True)
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
@@ -191,7 +191,7 @@
     assertValidationError = testutils.assertValidationError
 
     def test_base(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing')
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(transfer)
             access_rule = cnx.create_entity('SEDAAccessRule', seda_access_rule=unit_alt_seq)
--- a/test/test_html_generation.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_html_generation.py	Tue Apr 11 15:19:39 2017 +0200
@@ -32,7 +32,7 @@
 
     def setup_database(self):
         super(SEDAHTMLExportFuncTC, self).setup_database()
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             scheme = cnx.find('ConceptScheme', title=u'Keyword Types').one()
             some_concept = scheme.reverse_in_scheme[0]
             lang_rtype = cnx.find('CWRType', name='seda_language_to').one()
@@ -67,7 +67,7 @@
         return el_defs
 
     def test_profile1(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.entity_from_eid(self.transfer_eid)
             some_concept = cnx.entity_from_eid(self.concept_eid)
             profile = self.profile_etree(transfer)
--- a/test/test_profile_generation.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_profile_generation.py	Tue Apr 11 15:19:39 2017 +0200
@@ -222,7 +222,7 @@
 
     def test_keyword_path(self):
         element_defs = iter(XSDMMapping('Keyword'))
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
             kw = create('SEDAKeyword', user_cardinality=u'0..n')
             kt = create('SEDAKeywordType', seda_keyword_type_from=kw)
@@ -283,7 +283,7 @@
 
     def test_internal_reference(self):
         element_defs = iter(XSDMMapping('DataObjectReference'))
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
             transfer = create('SEDAArchiveTransfer', title=u'test profile')
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(
@@ -315,7 +315,7 @@
 class SEDA2RNGExportTC(RelaxNGTestMixin, CubicWebTC):
 
     def test_skipped_mandatory_simple(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             profile = self.profile_etree(cnx.create_entity('SEDAArchiveTransfer',
                                                            title=u'test profile'))
             date = self.get_element(profile, 'Date')
@@ -336,7 +336,7 @@
                  {'name': 'schemeVersionID', 'use': 'optional', 'type': 'xsd:token'}])
 
     def test_skipped_mandatory_complex(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             testutils.create_data_object(transfer, filename=u'fixed.txt')
             profile = self.profile_etree(transfer)
@@ -355,7 +355,7 @@
                                        'type': 'xsd:anyURI'}])
 
     def test_fileinfo_card(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             bdo = cnx.create_entity('SEDABinaryDataObject',
                                     user_annotation=u'I am mandatory',
@@ -379,7 +379,7 @@
             self.assertElementDefinition(fileinfo, {'name': 'FileInfo'})
 
     def test_data_object_package_card(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             bdo = cnx.create_entity('SEDABinaryDataObject',
                                     user_annotation=u'I am mandatory',
@@ -395,7 +395,7 @@
             self.assertElementDefinition(dop, {'name': 'DataObjectPackage'})
 
     def test_object_package_group(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             bdo = cnx.create_entity('SEDABinaryDataObject',
                                     user_annotation=u'I am number one',
@@ -419,7 +419,7 @@
             self.assertEqual(len(self.xpath(dop, './rng:group/*')), 3)
 
     def test_transfer_annotation(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             profile = self.profile_etree(cnx.create_entity('SEDAArchiveTransfer',
                                                            title=u'test profile',
                                                            user_annotation=u'some description'))
@@ -428,7 +428,7 @@
             self.assertEqual(docs[0].text, 'some description')
 
     def test_transfer_signature(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             cnx.create_entity('SEDASignature', seda_signature=transfer)
             profile = self.profile_etree(transfer)
@@ -438,7 +438,7 @@
             self.assertOpenTypeIsDefined(profile)
 
     def test_keyword(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             scheme = testutils.scheme_for_rtype(cnx, 'seda_keyword_type_to', u'theme')
@@ -501,7 +501,7 @@
                 [{'name': 'schemeURI', 'fixed': scheme.cwuri}])
 
     def test_code_list(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             scheme = cnx.create_entity('ConceptScheme', title=u'Keyword Types')
             cnx.create_entity('SEDAMimeTypeCodeListVersion',
@@ -526,7 +526,7 @@
                  {'name': 'listVersionID', 'use': 'optional', 'type': 'xsd:token'}])
 
     def test_seda2_concept(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
             scheme = create('ConceptScheme', title=u'Digest algorithm')
             some_concept = scheme.add_concept(label=u'md5 algorithm', language_code=u'en')
@@ -562,7 +562,7 @@
         self.assertEqual(len(open_types), 1)
 
     def test_data_duplicates(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(
                 transfer, user_cardinality=u'0..n')
@@ -575,7 +575,7 @@
     """Test that SEDA profile export works correctly."""
 
     def setup_database(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
             scheme = create('ConceptScheme', title=u'Keyword Types')
             # ensure we're able to export concept with unexpected language code
@@ -644,7 +644,7 @@
 
     def test_profile1(self):
         """Check a minimal SEDA profile validating BV2.0_min.xml."""
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             mda_scheme = cnx.find('ConceptScheme', title=u'Keyword Types').one()
             transfer = cnx.entity_from_eid(self.transfer_eid)
             root = self.profile_etree(transfer)
@@ -689,7 +689,7 @@
 
 class OldSEDAExportMixin(object):
     def setup_database(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             concepts = {}
@@ -808,7 +808,7 @@
         self.agent_eid = agent.eid
 
     def _test_profile(self, adapter_id, expected_file):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.entity_from_eid(self.transfer_eid)
             file_concept = cnx.entity_from_eid(self.file_concept_eid)
             agent = cnx.entity_from_eid(self.agent_eid)
@@ -868,7 +868,7 @@
 
     def test_seda_0_2_bordereau_ref(self):
         """Check a sample SEDA 0.2 profile validation."""
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             transfer = create('SEDAArchiveTransfer', title=u'test profile',
--- a/test/test_schema.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_schema.py	Tue Apr 11 15:19:39 2017 +0200
@@ -28,7 +28,7 @@
     assertValidationError = testutils.assertValidationError
 
     def setup_database(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             mt_scheme = testutils.scheme_for_type(cnx, 'seda_mime_type_to', None)
             mt_concept = mt_scheme.add_concept(label=u'text/plain')
             enc_scheme = testutils.scheme_for_type(cnx, 'seda_encoding_to', None)
@@ -40,7 +40,7 @@
             self.enc_concept = enc_concept.eid
 
     def test_code_lists_constraints_simple(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
             transfer = bdo.container[0]
             cnx.create_entity('SEDAMessageDigestAlgorithmCodeListVersion',
@@ -70,13 +70,13 @@
         cnx.commit()
 
     def test_archive_transfer_mime_type_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
             cnx.commit()  # will setup code list version
             self.assertMimeTypeConcept(bdo)
 
     def test_component_archive_unit_mime_type_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             bdo = testutils.create_data_object(unit_alt_seq)
             cnx.commit()
@@ -97,13 +97,13 @@
         cnx.commit()
 
     def test_archive_transfer_encoding_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
             cnx.commit()   # will setup code list version
             self.assertEncodingConcept(bdo)
 
     def test_component_archive_unit_encoding_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             bdo = testutils.create_data_object(unit_alt_seq)
             cnx.commit()
@@ -120,7 +120,7 @@
         cnx.commit()
 
     def test_archive_transfer_digest_algorithm_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             bdo = testutils.create_transfer_to_bdo(cnx)
             cnx.commit()  # commit first to get the container
             transfer = bdo.container[0]
@@ -131,7 +131,7 @@
             self.assertDigestAlgorithmConcept(bdo)
 
     def test_component_archive_unit_digest_algorithm_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             bdo = testutils.create_data_object(unit_alt_seq)
             bdo_type = cnx.find('CWEType', name=u'SEDABinaryDataObject').one()
@@ -147,7 +147,7 @@
     assertValidationError = testutils.assertValidationError
 
     def test_component_archive_unit_rule_constraint(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             for rule_type in ('access', 'appraisal'):
                 etype = 'SEDASeq{0}RuleRule'.format(rule_type.capitalize())
                 scheme = testutils.scheme_for_type(cnx, 'seda_rule', etype)
@@ -206,7 +206,7 @@
                              'G name IN("managers", "users")')
 
     def test_rule_default_cardinality(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'test profile')
             for rule_type in ('access', 'appraisal'):
                 rule_etype = 'SEDA{0}Rule'.format(rule_type.capitalize())
@@ -222,7 +222,7 @@
     def test_fti(self):
         # "Reverse" text to be searched in order not to be troubled by other
         # entities that may live in the DB (e.g. Concepts) with similar text.
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'Profile')
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(
                 transfer, title=u'transfer name'[::-1])
@@ -238,7 +238,7 @@
                     self.assertEqual([r for r, in rset.rows], [transfer.eid])
 
     def test_scheme_code_keyword_type_constraint(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             ckt_scheme = testutils.scheme_for_type(cnx, 'seda_keyword_type_to', None)
             ckt_concept = ckt_scheme.add_concept(label=u'geoname')
             scheme = testutils.scheme_for_type(cnx, 'seda_mime_type_to', None)
@@ -273,10 +273,10 @@
             cnx.commit()
 
     def test_profile(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             self.create_user(cnx, login='bob')
             cnx.commit()
-        with self.new_access('alice').repo_cnx() as cnx:
+        with self.new_access('alice').cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'Alice Profile')
             testutils.create_archive_unit(transfer)
             testutils.create_authority_record(cnx, u'Archival inc.',
@@ -288,7 +288,7 @@
                               seda_mime_type_code_list_version_from=transfer,
                               seda_mime_type_code_list_version_to=scheme)
             cnx.commit()
-        with self.new_access('bob').repo_cnx() as cnx:
+        with self.new_access('bob').cnx() as cnx:
             transfer = cnx.entity_from_eid(transfer.eid)
             # modification of the container
             with self.assertUnauthorized(cnx):
@@ -323,7 +323,7 @@
                 transfer.cw_delete()
 
     def test_archive_unit(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             cnx.commit()
 
@@ -332,7 +332,7 @@
             unit_alt_seq.reverse_seda_title[0].cw_set(title=u'gloup')
             cnx.commit()
 
-        with self.new_access('anon').client_cnx() as cnx:
+        with self.new_access('anon').cnx() as cnx:
             title = cnx.entity_from_eid(unit_alt_seq.reverse_seda_title[0].eid)
             unit = cnx.entity_from_eid(unit.eid)
             with self.assertUnauthorized(cnx):
@@ -345,7 +345,7 @@
                 title.cw_delete()
             with self.assertUnauthorized(cnx):
                 unit.cw_delete()
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit = cnx.entity_from_eid(unit.eid)
             unit.cw_delete()
             cnx.commit()
@@ -357,11 +357,11 @@
 
     def test_users_can_clone(self):
         """Functional test for SEDA component clone."""
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             cnx.commit()
 
-        with self.new_access('alice').repo_cnx() as cnx:
+        with self.new_access('alice').cnx() as cnx:
             unit = cnx.entity_from_eid(unit.eid)
             cloned = cnx.create_entity(unit.cw_etype, user_annotation=u'x', clone_of=unit)
             cnx.commit()
--- a/test/test_views.py	Mon Apr 10 15:42:43 2017 +0200
+++ b/test/test_views.py	Tue Apr 11 15:19:39 2017 +0200
@@ -36,7 +36,7 @@
 
 class ManagementRulesTC(CubicWebTC):
     def test_rule_ref_vocabulary(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             create = cnx.create_entity
 
             access_scheme = create('ConceptScheme', title=u'access')
@@ -72,7 +72,7 @@
                               (access_concept.label(), text_type(access_concept.eid))])
 
     def test_archive_unit_component_rule_ref_vocabulary(self):
-        with self.admin_access.client_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             unit, unit_alt, unit_alt_seq = testutils.create_archive_unit(None, cnx=cnx)
             for rule_type in ('access', 'appraisal'):
                 etype = 'SEDASeq{0}RuleRule'.format(rule_type.capitalize())
@@ -94,7 +94,7 @@
         """Check that a user cannot edit a SEDA profile he/she did not create."""
         alice_login = 'alice'
         bob_login = 'bob'
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             self.create_user(cnx, login=alice_login)
             self.create_user(cnx, login=bob_login)
             cnx.commit()
@@ -123,7 +123,7 @@
     """Functional test case about the relation widget."""
 
     def test_linkable_rset(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'Test widget')
             bdo = cnx.create_entity('SEDABinaryDataObject',
                                     user_annotation=u'I am mandatory',
@@ -140,7 +140,7 @@
             view = self.vreg['views'].select('search_related_entities', req,
                                              rset=compressed.as_rset())
             self.failIf(view.linkable_rset())
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             scheme = cnx.create_entity('ConceptScheme', title=u'CompressionAlgorithm')
             scheme.add_concept(label=u'bz2')
             cnx.create_entity('SEDACompressionAlgorithmCodeListVersion',
@@ -296,7 +296,7 @@
     """Functional test case about forms in the web interface."""
 
     def setup_database(self):
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             transfer = cnx.create_entity('SEDAArchiveTransfer', title=u'diagnosis testing',
                                          simplified_profile=True)
             archive_unit = testutils.create_archive_unit(transfer)[0]