[PATCH 4 of 6 saem_ref] [test] Change agent to record

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


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1488971076 -3600
#      Wed Mar 08 12:04:36 2017 +0100
# Node ID 95b2cca2860d312cf6e4692a3301778bf465a150
# Parent  fbe08b57c477ea2eb0ac547505e6d11d6e06d747
[test] Change agent to record

because that's what we're talking about. At some point in the past, record were
agents...

diff --git a/test/unittest_schema.py b/test/unittest_schema.py
--- a/test/unittest_schema.py
+++ b/test/unittest_schema.py
@@ -66,11 +66,11 @@ def assertUnauthorized(self, cnx):
         yield cm
         cnx.commit()
     cnx.rollback()
 
 
-def create_published_agents_panel(cnx):
+def create_published_records_panel(cnx):
     for name, kind in (
         (u"Mr Pink", u"person"),
         (u"Adams", u"family"),
         (u"Direction de la communication", u"authority"),
     ):
@@ -115,21 +115,21 @@ class SchemaConstraintsTC(CubicWebTC):
             self.assertEqual(rset.one().eid, pou.eid)
 
     def test_agent_authority_record_is_a_person(self):
         """Authority record for an agent is limited to person"""
         with self.admin_access.repo_cnx() as cnx:
-            create_published_agents_panel(cnx)
+            create_published_records_panel(cnx)
             peter = testutils.agent(cnx, u'Peter')
             self.assertEqual(
                 peter.unrelated('authority_record', 'AuthorityRecord').one(),
                 cnx.find("AuthorityRecord", has_text=u"Mr Pink").one(),
             )
 
     def test_organization_unit_authority_record_is_a_authority(self):
         """Authority record for an organization unit is limited to authority"""
         with self.admin_access.repo_cnx() as cnx:
-            create_published_agents_panel(cnx)
+            create_published_records_panel(cnx)
             pou = testutils.organization_unit(cnx, u'P OU')
             self.assertEqual(
                 pou.unrelated('authority_record', 'AuthorityRecord').one(),
                 cnx.find("AuthorityRecord", has_text=u"Direction de la communication").one(),
             )
@@ -391,17 +391,17 @@ class SecurityTC(CubicWebTC):
             self.create_user(cnx, login=u'toto', groups=('users', 'guests'),
                              authority=testutils.authority_with_naa(cnx))
             cnx.commit()
         with self.new_access('toto').client_cnx() as cnx:
             function = cnx.create_entity('AgentFunction', name=u'grouillot')
-            agent = testutils.authority_record(cnx, u'bob', reverse_function_agent=function)
+            record = testutils.authority_record(cnx, u'bob', reverse_function_agent=function)
             cnx.commit()
-            iwf = agent.cw_adapt_to('IWorkflowable')
+            iwf = record.cw_adapt_to('IWorkflowable')
             iwf.fire_transition('publish')
             cnx.commit()
-            # we can still modify a published agent
-            agent.reverse_name_entry_for[0].cw_set(parts=u'bobby')
+            # we can still modify a published record
+            record.reverse_name_entry_for[0].cw_set(parts=u'bobby')
             function.cw_set(name=u'director')
             cnx.commit()
 
     def test_update_root_badgroup(self):
         with self.admin_access.repo_cnx() as cnx:


More information about the saem-devel mailing list