From 1fc27c45f5659226fd6bf391cf6b9cc63784d281 Mon Sep 17 00:00:00 2001 From: Daniele Pantaleone Date: Mon, 13 Jul 2015 19:16:21 +0200 Subject: [PATCH] [TESTS] updated test cases to comply with the new configuration file changes --- b3/plugins/login/__init__.py | 2 +- tests/core/parsers/test_iourt42.py | 2 +- tests/core/test_main_config.py | 54 ++++++++++++++-------------- tests/plugins/admin/test_commands.py | 2 +- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/b3/plugins/login/__init__.py b/b3/plugins/login/__init__.py index bb4982086..0fd095769 100644 --- a/b3/plugins/login/__init__.py +++ b/b3/plugins/login/__init__.py @@ -46,7 +46,7 @@ def onLoadConfig(self): Load plugin configuration. """ self._threshold = self.getSetting('settings', 'thresholdlevel', b3.INT, self._threshold) - self._passwdlevel = self.getSetting('settings', 'passwdlevel', b3.LEVEL, self._passwdlevel) + self._passwdlevel = self.getSetting('settings', 'passwdlevel', b3.INT, self._passwdlevel) def onStartup(self): """ diff --git a/tests/core/parsers/test_iourt42.py b/tests/core/parsers/test_iourt42.py index 7c4cf8c39..1c092dafa 100644 --- a/tests/core/parsers/test_iourt42.py +++ b/tests/core/parsers/test_iourt42.py @@ -924,7 +924,7 @@ def test_saybig(self): def test_message(self): self.console.message(self.player, "f00") - self.console.write.assert_has_calls(call('tell 4 ^8[pm]^7 f00')) + self.console.write.assert_has_calls([call('tell 4 ^8[pm]^7 f00')]) def test_kick(self): diff --git a/tests/core/test_main_config.py b/tests/core/test_main_config.py index 761b4e1d5..ade5f7e85 100644 --- a/tests/core/test_main_config.py +++ b/tests/core/test_main_config.py @@ -74,18 +74,18 @@ def test_get_external_plugins_dir(self): def test_get_plugins(self): self.assertListEqual([ - {'name': 'admin', 'conf': '@conf/plugin_admin.ini', 'disabled': False, 'path': None}, - {'name': 'adv', 'conf': '@conf/plugin_adv.xml', 'disabled': False, 'path': None}, - {'name': 'censor', 'conf': '@conf/plugin_censor.xml', 'disabled': False, 'path': None}, - {'name': 'cmdmanager', 'conf': '@conf/plugin_cmdmanager.ini', 'disabled': False, 'path': None}, - {'name': 'pingwatch', 'conf': '@conf/plugin_pingwatch.ini', 'disabled': False, 'path': None}, - {'name': 'pluginmanager', 'conf': '@conf/plugin_pluginmanager.ini', 'disabled': False, 'path': None}, - {'name': 'punkbuster', 'conf': '@conf/plugin_punkbuster.ini', 'disabled': False, 'path': None}, - {'name': 'spamcontrol', 'conf': '@conf/plugin_spamcontrol.ini', 'disabled': False, 'path': None}, - {'name': 'stats', 'conf': '@conf/plugin_stats.ini', 'disabled': False, 'path': None}, - {'name': 'status', 'conf': '@conf/plugin_status.ini', 'disabled': False, 'path': None}, - {'name': 'tk', 'conf': '@conf/plugin_tk.ini', 'disabled': False, 'path': None}, - {'name': 'welcome', 'conf': '@conf/plugin_welcome.ini', 'disabled': False, 'path': None}, + {'name': 'admin', 'conf': '@b3/conf/plugin_admin.ini', 'disabled': False, 'path': None}, + {'name': 'adv', 'conf': '@b3/conf/plugin_adv.xml', 'disabled': False, 'path': None}, + {'name': 'censor', 'conf': '@b3/conf/plugin_censor.xml', 'disabled': False, 'path': None}, + {'name': 'cmdmanager', 'conf': '@b3/conf/plugin_cmdmanager.ini', 'disabled': False, 'path': None}, + {'name': 'pingwatch', 'conf': '@b3/conf/plugin_pingwatch.ini', 'disabled': False, 'path': None}, + {'name': 'pluginmanager', 'conf': '@b3/conf/plugin_pluginmanager.ini', 'disabled': False, 'path': None}, + {'name': 'punkbuster', 'conf': '@b3/conf/plugin_punkbuster.ini', 'disabled': False, 'path': None}, + {'name': 'spamcontrol', 'conf': '@b3/conf/plugin_spamcontrol.ini', 'disabled': False, 'path': None}, + {'name': 'stats', 'conf': '@b3/conf/plugin_stats.ini', 'disabled': False, 'path': None}, + {'name': 'status', 'conf': '@b3/conf/plugin_status.ini', 'disabled': False, 'path': None}, + {'name': 'tk', 'conf': '@b3/conf/plugin_tk.ini', 'disabled': False, 'path': None}, + {'name': 'welcome', 'conf': '@b3/conf/plugin_welcome.ini', 'disabled': False, 'path': None}, ], self.conf.get_plugins()) @@ -195,11 +195,11 @@ def test_plugins(self): conf_xml, conf_cfg = self.init(dedent(r""" - - - - - + + + + + """), dedent(r""" @@ -207,22 +207,22 @@ def test_plugins(self): disabled_plugins: adv, tk [plugins] - admin: @conf/plugin_admin.ini - adv: @conf/plugin_adv.xml - censor: @conf/plugin_censor.xml - cmdmanager: @conf/plugin_cmdmanager.ini - tk: @conf/plugin_tk.ini + admin: @b3/conf/plugin_admin.ini + adv: @b3/conf/plugin_adv.xml + censor: @b3/conf/plugin_censor.xml + cmdmanager: @b3/conf/plugin_cmdmanager.ini + tk: @b3/conf/plugin_tk.ini [plugins_custom_path] cmdmanager: /somewhere/else """)) # normalized path for empty string is the current directory ('.') expected_result = [ - {'name': 'admin', 'conf': '@conf/plugin_admin.ini', 'disabled': False, 'path': None}, - {'name': 'adv', 'conf': '@conf/plugin_adv.xml', 'disabled': True, 'path': None}, - {'name': 'censor', 'conf': '@conf/plugin_censor.xml', 'disabled': False, 'path': None}, - {'name': 'cmdmanager', 'conf': '@conf/plugin_cmdmanager.ini', 'disabled': False, 'path': '/somewhere/else'}, - {'name': 'tk', 'conf': '@conf/plugin_tk.ini', 'disabled': True, 'path': None}, + {'name': 'admin', 'conf': '@b3/conf/plugin_admin.ini', 'disabled': False, 'path': None}, + {'name': 'adv', 'conf': '@b3/conf/plugin_adv.xml', 'disabled': True, 'path': None}, + {'name': 'censor', 'conf': '@b3/conf/plugin_censor.xml', 'disabled': False, 'path': None}, + {'name': 'cmdmanager', 'conf': '@b3/conf/plugin_cmdmanager.ini', 'disabled': False, 'path': '/somewhere/else'}, + {'name': 'tk', 'conf': '@b3/conf/plugin_tk.ini', 'disabled': True, 'path': None}, ] self.assertListEqual(expected_result, conf_xml.get_plugins()) self.assertListEqual(expected_result, conf_cfg.get_plugins()) \ No newline at end of file diff --git a/tests/plugins/admin/test_commands.py b/tests/plugins/admin/test_commands.py index 441cf4361..098863f48 100644 --- a/tests/plugins/admin/test_commands.py +++ b/tests/plugins/admin/test_commands.py @@ -176,7 +176,7 @@ def test_when_there_is_already_a_superadmin(self): self.p.console.clients.lookupSuperAdmins = Mock(return_value=[Mock(spec=Client)]) self.iamgod() - self.p.warning.assert_called() + self.assertTrue(self.p.warning.called) self.assertNotIn('iamgod', self.p._commands)