server/test/unittest_migractions.py
changeset 972 1efba3fd1364
parent 934 f94e34795586
child 1016 26387b836099
child 1251 af40e615dc89
--- a/server/test/unittest_migractions.py	Thu Feb 26 13:10:33 2009 +0100
+++ b/server/test/unittest_migractions.py	Thu Feb 26 13:12:04 2009 +0100
@@ -40,6 +40,8 @@
         self.mh = ServerMigrationHelper(self.repo.config, migrschema,
                                         repo=self.repo, cnx=self.cnx,
                                         interactive=False)
+        assert self.cnx is self.mh._cnx
+        assert self.session is self.mh.session, (self.session.id, self.mh.session.id)
         
     def test_add_attribute_int(self):
         self.failIf('whatever' in self.schema)
@@ -424,6 +426,16 @@
             # why this commit is necessary is unclear to me (though without it
             # next test may fail complaining of missing tables
             self.commit() 
+
+    def test_set_state(self):
+        user = self.session.user
+        self.set_debug(True)
+        self.mh.set_state(user.eid, 'deactivated')
+        user.clear_related_cache('in_state', 'subject')
+        try:
+            self.assertEquals(user.state, 'deactivated')
+        finally:
+            self.set_debug(False)
         
 if __name__ == '__main__':
     unittest_main()