[db creation test] more testing of db initialization: call build_db_cache and ensure admin user exists
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 10 Sep 2012 16:07:13 +0200
changeset 8558 133101245cac
parent 8557 8756f932ca83
child 8559 8db29e17dd33
[db creation test] more testing of db initialization: call build_db_cache and ensure admin user exists
test/unittest_migration.py
--- a/test/unittest_migration.py	Mon Sep 17 17:52:17 2012 +0200
+++ b/test/unittest_migration.py	Mon Sep 10 16:07:13 2012 +0200
@@ -108,7 +108,13 @@
         self.assertEqual(source['db-driver'], 'sqlite')
         handler = get_test_db_handler(config)
         handler.init_test_database()
-
+        handler.build_db_cache()
+        repo, cnx = handler.get_repo_and_cnx()
+        cu = cnx.cursor()
+        self.assertEqual(cu.execute('Any SN WHERE X is CWUser, X login "admin", X in_state S, S name SN').rows,
+                          [['activated']])
+        cnx.close()
+        repo.shutdown()
 
 if __name__ == '__main__':
     unittest_main()