def test_database_config(self):
        open_ihm_config = OpenIHMConfig()

        expected = {
            'host': 'localhost',
            'database': 'openihmdb',
            'user': '******',
            'password': '******',
            'port': 3306,
            'superuser': '******',
            'superuser_password': '',
        }
        self.assertEqual(expected, open_ihm_config.database_config())
Beispiel #2
0
 def __init__(self):
     config = OpenIHMConfig()
     self.real_config = config
     self.test_dir = os.path.dirname(__file__)
     config_file = os.path.join(self.test_dir, '..', 'test_openihm.cfg')
     read = config.read(config_file)
     if len(read) != 1:
         m = 'Need test_openihm.cfg setup with database parameters'
         e = unittest.SkipTest(m)
         raise e
     Config.set_config(config)
     self.dbconfig = config.database_config()
     self.config = DbConfig(**self.dbconfig)
    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())