server/test/unittest_migractions.py
changeset 972 1efba3fd1364
parent 934 f94e34795586
child 1016 26387b836099
child 1251 af40e615dc89
equal deleted inserted replaced
971:3abae727d121 972:1efba3fd1364
    38             self.repo.hm.deactivate_verification_hooks()
    38             self.repo.hm.deactivate_verification_hooks()
    39         RepositoryBasedTC.setUp(self)
    39         RepositoryBasedTC.setUp(self)
    40         self.mh = ServerMigrationHelper(self.repo.config, migrschema,
    40         self.mh = ServerMigrationHelper(self.repo.config, migrschema,
    41                                         repo=self.repo, cnx=self.cnx,
    41                                         repo=self.repo, cnx=self.cnx,
    42                                         interactive=False)
    42                                         interactive=False)
       
    43         assert self.cnx is self.mh._cnx
       
    44         assert self.session is self.mh.session, (self.session.id, self.mh.session.id)
    43         
    45         
    44     def test_add_attribute_int(self):
    46     def test_add_attribute_int(self):
    45         self.failIf('whatever' in self.schema)
    47         self.failIf('whatever' in self.schema)
    46         paraordernum = self.mh.rqlexec('Any O WHERE X name "Note", RT name "para", RDEF from_entity X, RDEF relation_type RT, RDEF ordernum O')[0][0]
    48         paraordernum = self.mh.rqlexec('Any O WHERE X name "Note", RT name "para", RDEF from_entity X, RDEF relation_type RT, RDEF ordernum O')[0][0]
    47         self.mh.cmd_add_attribute('Note', 'whatever')
    49         self.mh.cmd_add_attribute('Note', 'whatever')
   422             #        types (and their associated tables!)
   424             #        types (and their associated tables!)
   423             self.maxeid = self.execute('Any MAX(X)')[0][0]
   425             self.maxeid = self.execute('Any MAX(X)')[0][0]
   424             # why this commit is necessary is unclear to me (though without it
   426             # why this commit is necessary is unclear to me (though without it
   425             # next test may fail complaining of missing tables
   427             # next test may fail complaining of missing tables
   426             self.commit() 
   428             self.commit() 
       
   429 
       
   430     def test_set_state(self):
       
   431         user = self.session.user
       
   432         self.set_debug(True)
       
   433         self.mh.set_state(user.eid, 'deactivated')
       
   434         user.clear_related_cache('in_state', 'subject')
       
   435         try:
       
   436             self.assertEquals(user.state, 'deactivated')
       
   437         finally:
       
   438             self.set_debug(False)
   427         
   439         
   428 if __name__ == '__main__':
   440 if __name__ == '__main__':
   429     unittest_main()
   441     unittest_main()