server/test/unittest_repository.py
branchstable
changeset 5213 8604000bf3b2
parent 5126 c869d8e7d166
child 5238 31c12863fd9d
child 5421 8167de96c523
equal deleted inserted replaced
5212:a545eb9add6f 5213:8604000bf3b2
   398             req = self.request()
   398             req = self.request()
   399             # XXX will fail with python -O
   399             # XXX will fail with python -O
   400             self.assertRaises(AssertionError, req.create_entity,
   400             self.assertRaises(AssertionError, req.create_entity,
   401                               'EmailAddress', address=u'a@b.fr')
   401                               'EmailAddress', address=u'a@b.fr')
   402 
   402 
       
   403     def test_multiple_edit_set_attributes(self):
       
   404         """make sure edited_attributes doesn't get cluttered
       
   405         by previous entities on multiple set
       
   406         """
       
   407         # local hook
       
   408         class DummyBeforeHook(Hook):
       
   409             _test = self # keep reference to test instance
       
   410             __regid__ = 'dummy-before-hook'
       
   411             __select__ = Hook.__select__ & implements('Affaire')
       
   412             events = ('before_update_entity',)
       
   413             def __call__(self):
       
   414                 # invoiced attribute shouldn't be considered "edited" before the hook
       
   415                 self._test.failIf('invoiced' in self.entity.edited_attributes,
       
   416                                   'edited_attributes cluttered by previous update')
       
   417                 self.entity['invoiced'] = 10
       
   418         with self.temporary_appobjects(DummyBeforeHook):
       
   419             req = self.request()
       
   420             req.create_entity('Affaire', ref=u'AFF01')
       
   421             req.create_entity('Affaire', ref=u'AFF02')
       
   422             req.execute('SET A duration 10 WHERE A is Affaire')
       
   423 
   403 
   424 
   404 class DataHelpersTC(CubicWebTC):
   425 class DataHelpersTC(CubicWebTC):
   405 
   426 
   406     def test_create_eid(self):
   427     def test_create_eid(self):
   407         self.session.set_pool()
   428         self.session.set_pool()