hooks/test/unittest_hooks.py
changeset 11034 75d752e6daf7
parent 11033 63d860a14a17
equal deleted inserted replaced
11033:63d860a14a17 11034:75d752e6daf7
    24 
    24 
    25 from datetime import datetime
    25 from datetime import datetime
    26 
    26 
    27 from six import text_type
    27 from six import text_type
    28 
    28 
       
    29 from pytz import utc
    29 from cubicweb import ValidationError, AuthenticationError, BadConnectionId
    30 from cubicweb import ValidationError, AuthenticationError, BadConnectionId
    30 from cubicweb.devtools.testlib import CubicWebTC
    31 from cubicweb.devtools.testlib import CubicWebTC
    31 
    32 
    32 
    33 
    33 class CoreHooksTC(CubicWebTC):
    34 class CoreHooksTC(CubicWebTC):
   113             entity = cnx.create_entity('Workflow', name=u'wf1')
   114             entity = cnx.create_entity('Workflow', name=u'wf1')
   114             self.assertEqual(entity.cwuri, self.repo.config['base-url'] + str(entity.eid))
   115             self.assertEqual(entity.cwuri, self.repo.config['base-url'] + str(entity.eid))
   115 
   116 
   116     def test_metadata_creation_modification_date(self):
   117     def test_metadata_creation_modification_date(self):
   117         with self.admin_access.repo_cnx() as cnx:
   118         with self.admin_access.repo_cnx() as cnx:
   118             _now = datetime.utcnow()
   119             _now = datetime.now(utc)
   119             entity = cnx.create_entity('Workflow', name=u'wf1')
   120             entity = cnx.create_entity('Workflow', name=u'wf1')
   120             self.assertEqual((entity.creation_date - _now).seconds, 0)
   121             self.assertEqual((entity.creation_date - _now).seconds, 0)
   121             self.assertEqual((entity.modification_date - _now).seconds, 0)
   122             self.assertEqual((entity.modification_date - _now).seconds, 0)
   122 
   123 
   123     def test_metadata_created_by(self):
   124     def test_metadata_created_by(self):