hooks/test/unittest_hooks.py
changeset 4051 eec34250a645
parent 3536 f6c9a5df80fb
child 4055 03443dfb6fa4
equal deleted inserted replaced
4050:f2e1bb4b7536 4051:eec34250a645
   164     def test_metadata_owned_by(self):
   164     def test_metadata_owned_by(self):
   165         entity = self.add_entity('Bookmark', title=u'wf1', path=u'/view')
   165         entity = self.add_entity('Bookmark', title=u'wf1', path=u'/view')
   166         self.commit() # fire operations
   166         self.commit() # fire operations
   167         self.assertEquals(len(entity.owned_by), 1) # make sure we have only one owner
   167         self.assertEquals(len(entity.owned_by), 1) # make sure we have only one owner
   168         self.assertEquals(entity.owned_by[0].eid, self.session.user.eid)
   168         self.assertEquals(entity.owned_by[0].eid, self.session.user.eid)
       
   169 
       
   170     def test_user_login_stripped(self):
       
   171         u = self.create_user('  joe  ')
       
   172         tname = self.execute('Any L WHERE E login L, E eid %(e)s',
       
   173                              {'e': u.eid})[0][0]
       
   174         self.assertEquals(tname, 'joe')
       
   175         self.execute('SET X login " jijoe " WHERE X eid %(x)s', {'x': u.eid})
       
   176         tname = self.execute('Any L WHERE E login L, E eid %(e)s',
       
   177                              {'e': u.eid})[0][0]
       
   178         self.assertEquals(tname, 'jijoe')
   169 
   179 
   170 
   180 
   171 
   181 
   172 class UserGroupHooksTC(CubicWebTC):
   182 class UserGroupHooksTC(CubicWebTC):
   173 
   183