Esempio n. 1
0
def test_add_command():
 f = lambda obj: None
 with pytest.raises(ValueError):
  commands.add_command('', f)
 f.name = 'test'
 commands.add_command('', f)
 assert not f.access
 f.access = 'tits'
 with pytest.raises(ValueError):
  commands.add_command('', f)
 f.access = commands.objects.players.WIZARD
 commands.add_command('', f)
 assert f.access == commands.objects.players.WIZARD
Esempio n. 2
0
    def add_command(self, command, func):
        def func_proxy(main_window, argv):
            ct = main_window.current_tab

            if not ct:
                server_name = ""
                target_name = ""
            elif type(ct) == tabs.Server:
                server_name = ct.name
                target_name = ""
            else:
                server_name = tabs.get_server(ct).name
                target_name = ct.name

            return func(server_name, target_name, argv[1:])

        # 		self.emit("command_add", command, func)
        return commands.add_command(command, func_proxy)