def test_sqlalchemy_config_file(self): open_ihm_config = OpenIHMConfig() config_file = """ [database] superuser = master superuser_password = password driver = mysql+mysqlconnector """ open_ihm_config.readfp(io.BytesIO(config_file)) expected = 'mysql+mysqlconnector://master:password@localhost/openihmdb' self.assertEqual(expected, open_ihm_config.sqlalchemy_superuser_connection_string())
def test_read_config_file_port_default(self): open_ihm_config = OpenIHMConfig() config_file = """ [database] superuser = master superuser_password = password """ open_ihm_config.readfp(io.BytesIO(config_file)) expected = { 'host': 'localhost', 'database': 'openihmdb', 'user': '******', 'password': '******', 'port': 3306, 'superuser': '******', 'superuser_password': '******', } self.assertEqual(expected, open_ihm_config.database_config())