def test_old_connection_unix_port(self): open_ihm_config = OpenHEAConfig() config_file = """ [database] superuser = master superuser_password = password port = 3307 unix_socket = /home/jenkins/mysql/mysql.sock """ open_ihm_config.readfp(io.BytesIO(config_file)) sexpected = { 'host': 'localhost', 'database': 'openheadb', 'user': '******', 'password': '******', 'charset': 'utf8', 'use_unicode': True, 'get_warnings': True, 'unix_socket': '/home/jenkins/mysql/mysql.sock', } self.assertEqual(sexpected, open_ihm_config.superuser_dbinfo()) expected = { 'host': 'localhost', 'database': 'openheadb', 'user': '******', 'password': '******', 'charset': 'utf8', 'use_unicode': True, 'get_warnings': True, 'unix_socket': '/home/jenkins/mysql/mysql.sock', } self.assertEqual(expected, open_ihm_config.dbinfo())
def test_database_config_issue_38(self): # this issue was caused by not protecting the # default values dictionary so it got broken # after using it for one purpose. open_ihm_config = OpenHEAConfig() expected = { 'host': 'localhost', 'database': 'openheadb', 'user': '******', 'password': '******', 'charset': 'utf8', 'use_unicode': True, 'get_warnings': True, } self.assertEqual(expected, open_ihm_config.dbinfo()) expected = { 'host': 'localhost', 'database': 'openheadb', 'user': '******', 'password': '', 'charset': 'utf8', 'use_unicode': True, 'get_warnings': True, } self.assertEqual(expected, open_ihm_config.superuser_dbinfo())
def test_database_config_superuser_dbinfo(self): open_ihm_config = OpenHEAConfig() expected = { 'host': 'localhost', 'database': 'openheadb', 'user': '******', 'password': '', 'charset': 'utf8', 'use_unicode': True, 'get_warnings': True, } self.assertEqual(expected, open_ihm_config.superuser_dbinfo())