diff --git a/irctest/controllers/oragono.py b/irctest/controllers/oragono.py index 2749a78..38f4fe2 100644 --- a/irctest/controllers/oragono.py +++ b/irctest/controllers/oragono.py @@ -209,6 +209,32 @@ class OragonoController(BaseServerController, DirectoryBasedController): config.update(LOGGING_CONFIG) return config + def addMysqlToConfig(self): + mysql_password = os.getenv('MYSQL_PASSWORD') + if not mysql_password: + return None + config = self.baseConfig() + config['datastore']['mysql'] = { + "enabled": True, + "host": "localhost", + "user": "oragono", + "password": mysql_password, + "history-database": "oragono_history", + "timeout": "3s", + } + config['accounts']['multiclient'] = { + 'enabled': True, + 'allowed-by-default': True, + 'always-on': 'disabled', + } + config['history']['persistent'] = { + "enabled": True, + "unregistered-channels": True, + "registered-channels": "opt-out", + "direct-messages": "opt-out", + } + return config + def rehash(self, case, config): self._config = config self._write_config() diff --git a/irctest/server_tests/test_chathistory.py b/irctest/server_tests/test_chathistory.py index 6734321..54c8081 100644 --- a/irctest/server_tests/test_chathistory.py +++ b/irctest/server_tests/test_chathistory.py @@ -112,31 +112,7 @@ class ChathistoryTestCase(cases.BaseServerTestCase): self.validate_chathistory(echo_messages, 1, chname) def customizedConfig(self): - if MYSQL_PASSWORD == "": - return None - - # enable mysql-backed history for all channels and logged-in clients - config = self.controller.baseConfig() - config['datastore']['mysql'] = { - "enabled": True, - "host": "localhost", - "user": "oragono", - "password": MYSQL_PASSWORD, - "history-database": "oragono_history", - "timeout": "3s", - } - config['accounts']['multiclient'] = { - 'enabled': True, - 'allowed-by-default': True, - 'always-on': 'disabled', - } - config['history']['persistent'] = { - "enabled": True, - "unregistered-channels": True, - "registered-channels": "opt-out", - "direct-messages": "opt-out", - } - return config + return self.controller.addMysqlToConfig() @cases.SpecificationSelector.requiredBySpecification('Oragono') def testChathistoryDMs(self): diff --git a/irctest/server_tests/test_znc_playback.py b/irctest/server_tests/test_znc_playback.py index 2591a62..5fd28e9 100644 --- a/irctest/server_tests/test_znc_playback.py +++ b/irctest/server_tests/test_znc_playback.py @@ -7,6 +7,9 @@ from irctest.irc_utils.random import random_name class ZncPlaybackTestCase(cases.BaseServerTestCase): + def customizedConfig(self): + return self.controller.addMysqlToConfig() + @cases.SpecificationSelector.requiredBySpecification('Oragono') def testZncPlayback(self): chname = random_name('#znc_channel')