server/test/unittest_ldapuser.py
branch3.5
changeset 2920 64322aa83a1d
parent 1977 606923dff11b
child 2968 0e3460341023
child 3587 5b3725f315fc
equal deleted inserted replaced
2919:662f35236d1c 2920:64322aa83a1d
   154         syt = self.execute('CWUser X WHERE X login "syt"').get_entity(0, 0)
   154         syt = self.execute('CWUser X WHERE X login "syt"').get_entity(0, 0)
   155         self.assertEquals([g.name for g in syt.in_group], ['managers', 'users'])
   155         self.assertEquals([g.name for g in syt.in_group], ['managers', 'users'])
   156         self.patch_authenticate()
   156         self.patch_authenticate()
   157         cnx = self.login('syt', 'dummypassword')
   157         cnx = self.login('syt', 'dummypassword')
   158         cu = cnx.cursor()
   158         cu = cnx.cursor()
   159         cu.execute('SET X in_state S WHERE X login "alf", S name "deactivated"')
   159         alf = cu.execute('Any X WHERE X login "alf"').get_entity(0, 0)
       
   160         alf.fire_transition('deactivate')
   160         try:
   161         try:
   161             cnx.commit()
   162             cnx.commit()
   162             alf = self.execute('CWUser X WHERE X login "alf"').get_entity(0, 0)
   163             alf = self.execute('CWUser X WHERE X login "alf"').get_entity(0, 0)
   163             self.assertEquals(alf.in_state[0].name, 'deactivated')
   164             self.assertEquals(alf.in_state[0].name, 'deactivated')
   164             trinfo = alf.latest_trinfo()
   165             trinfo = alf.latest_trinfo()
   170                                 {'x': alf.eid}, 'x')
   171                                 {'x': alf.eid}, 'x')
   171             self.assertEquals(rset.rows, [[syt.eid]])
   172             self.assertEquals(rset.rows, [[syt.eid]])
   172         finally:
   173         finally:
   173             # restore db state
   174             # restore db state
   174             self.restore_connection()
   175             self.restore_connection()
   175             self.execute('SET X in_state S WHERE X login "alf", S name "activated"')
   176             alf = self.execute('Any X WHERE X login "alf"').get_entity(0, 0)
       
   177             alf.fire_transition('activate')
   176             self.execute('DELETE X in_group G WHERE X login "syt", G name "managers"')
   178             self.execute('DELETE X in_group G WHERE X login "syt", G name "managers"')
   177 
   179 
   178     def test_same_column_names(self):
   180     def test_same_column_names(self):
   179         self.execute('Any X, Y WHERE X copain Y, X login "comme", Y login "cochon"')
   181         self.execute('Any X, Y WHERE X copain Y, X login "comme", Y login "cochon"')
   180 
   182