Skip to content

Commit

Permalink
[TESTS] updated test cases to comply with the new configuration file …
Browse files Browse the repository at this point in the history
…changes
  • Loading branch information
danielepantaleone committed Jul 13, 2015
1 parent a7283d0 commit 1fc27c4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion b3/plugins/login/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/core/parsers/test_iourt42.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
54 changes: 27 additions & 27 deletions tests/core/test_main_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())


Expand Down Expand Up @@ -195,34 +195,34 @@ def test_plugins(self):
conf_xml, conf_cfg = self.init(dedent(r"""
<configuration>
<plugins>
<plugin name="admin" config="@conf/plugin_admin.ini" />
<plugin name="adv" config="@conf/plugin_adv.xml" disabled="yes" />
<plugin name="censor" config="@conf/plugin_censor.xml" disabled="no" />
<plugin name="cmdmanager" config="@conf/plugin_cmdmanager.ini" path="/somewhere/else" />
<plugin name="tk" config="@conf/plugin_tk.ini" disabled="1" />
<plugin name="admin" config="@b3/conf/plugin_admin.ini" />
<plugin name="adv" config="@b3/conf/plugin_adv.xml" disabled="yes" />
<plugin name="censor" config="@b3/conf/plugin_censor.xml" disabled="no" />
<plugin name="cmdmanager" config="@b3/conf/plugin_cmdmanager.ini" path="/somewhere/else" />
<plugin name="tk" config="@b3/conf/plugin_tk.ini" disabled="1" />
</plugins>
</configuration>
"""), dedent(r"""
[b3]
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())
2 changes: 1 addition & 1 deletion tests/plugins/admin/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 1fc27c4

Please sign in to comment.