[PATCH 1 of 4 eac] [test] Use access.cnx instead of client_cnx / repo_cnx

Sylvain Thenault sylvain.thenault at logilab.fr
Wed Mar 8 10:13:13 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1488958652 -3600
#      Wed Mar 08 08:37:32 2017 +0100
# Node ID c9196da24e2fd404869441f8306cf5d4161e2911
# Parent  002bb3a3dcf1f59a0df68e2785a27826ba0241f1
[test] Use access.cnx instead of client_cnx / repo_cnx

diff --git a/test/test_schema.py b/test/test_schema.py
--- a/test/test_schema.py
+++ b/test/test_schema.py
@@ -39,11 +39,11 @@ class SchemaConstraintsTC(CubicWebTC):
 
     def test_on_create_set_end_date_before_start_date(self):
         """ create an entity whose end_date is before start_date.
         ValidationError expected
         """
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             with self.assertValidationError(cnx) as cm:
                 testutils.authority_record(cnx, u'Arthur',
                                            start_date=date(524, 2, 9),
                                            end_date=date(500, 7, 12))
             self.assertIn("must be less than", str(cm.exception))
@@ -54,11 +54,11 @@ class SchemaConstraintsTC(CubicWebTC):
         """
         if sqlite3.sqlite_version_info < (3, 7, 12):
             # with sqlite earlier than 3.7.12, boundary constraints are not checked by the database,
             # hence the constraint is only triggered on start_date modification
             self.skipTest('unsupported sqlite version')
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             agent = testutils.authority_record(cnx, u'Arthur',
                                                start_date=date(454, 2, 9),
                                                end_date=date(475, 4, 12))
             cnx.commit()
             with self.assertValidationError(cnx) as cm:
@@ -69,11 +69,11 @@ class SchemaConstraintsTC(CubicWebTC):
         """ create an entity without start_date :
             No constraint on the end_date
             update the entity with a start_date set after the start_date :
             ValidationError expected
         """
-        with self.admin_access.repo_cnx() as cnx:
+        with self.admin_access.cnx() as cnx:
             agent = testutils.authority_record(cnx, u'Arthur', end_date=date(476, 2, 9))
             cnx.commit()
             with self.assertValidationError(cnx) as cm:
                 agent.cw_set(start_date=date(527, 4, 12))
             self.assertIn("must be less than", str(cm.exception))


More information about the saem-devel mailing list