def test_cropsExist(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.helper.setup_db_file('openihmdb_mysql_fix59.sql')
     # FIXME: push some data into the relevant table.
     #self._execute_instruction('insert into setup_foods_crops values (%s)')
     assert database_initialiser.cropsExist()
 def test_initialiseDB(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.assertEqual({
         'mysqlstarted': True,
         'dbinstalled': True,
         'dbuptodate': True}, database_initialiser.initialiseDB())
 def test_updateDatabase(self):
     # NOTE: it might be worth adding a test that compares the new
     # database to the updated database to check they match.
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     # this isn't much of a check...
     # our coverage isn't very good.
     assert database_initialiser.updateDatabase()
 def test_updateDatabase_needs_update(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.make_db_outofdate()
     self.helper.setup_db_file('openihmdb_mysql_update.sql')
     assert database_initialiser.updateDatabase()
 def test_setupStartupCrops(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.helper.setup_db_file('openihmdb_mysql_fix59.sql')
     assert database_initialiser.setupStartupCrops()
 def test_databaseUpToDate_fresh_db(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.helper.execute_instruction('delete from dbupdate')
     assert database_initialiser.databaseUpToDate()
 def test_databaseUpToDate_needupdate(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     self.make_db_outofdate()
     assert not database_initialiser.databaseUpToDate()
 def test_databaseUpToDate(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_clean_db()
     assert database_initialiser.databaseUpToDate()
 def test_createDatabase(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.helper.setup_db_file('openihmdb_mysql.sql')
     assert database_initialiser.createDatabase()
Exemplo n.º 10
0
 def setup_clean_db(self):
     database_initialiser = DatabaseInitialiser(self.config)
     self.setup_db_file('openihmdb_mysql.sql')
     self.grant_permissions()
     assert database_initialiser.createDatabase()