List 'kill' MPD command in 'notcommands' instead of 'commands'
This commit is contained in:
parent
7f7d79b21f
commit
c9506ca7e1
@ -17,6 +17,9 @@ def commands(context):
|
|||||||
|
|
||||||
sorted_commands = sorted(list(mpd_commands))
|
sorted_commands = sorted(list(mpd_commands))
|
||||||
|
|
||||||
|
# No permission to use
|
||||||
|
sorted_commands.remove('kill')
|
||||||
|
|
||||||
# Not shown by MPD in its command list
|
# Not shown by MPD in its command list
|
||||||
sorted_commands.remove('command_list_begin')
|
sorted_commands.remove('command_list_begin')
|
||||||
sorted_commands.remove('command_list_ok_begin')
|
sorted_commands.remove('command_list_ok_begin')
|
||||||
@ -59,7 +62,13 @@ def notcommands(context):
|
|||||||
# authenticated, 'notcommands' should list all the commands the client does
|
# authenticated, 'notcommands' should list all the commands the client does
|
||||||
# not have access to. To implement this we need access to the session
|
# not have access to. To implement this we need access to the session
|
||||||
# object to check if the client is authenticated or not.
|
# object to check if the client is authenticated or not.
|
||||||
pass
|
|
||||||
|
commands = []
|
||||||
|
|
||||||
|
# No permission to use
|
||||||
|
commands.append('kill')
|
||||||
|
|
||||||
|
return [('command', c) for c in sorted(commands)]
|
||||||
|
|
||||||
@handle_pattern(r'^tagtypes$')
|
@handle_pattern(r'^tagtypes$')
|
||||||
def tagtypes(context):
|
def tagtypes(context):
|
||||||
|
|||||||
@ -20,6 +20,8 @@ class ReflectionHandlerTest(unittest.TestCase):
|
|||||||
self.assert_(u'command: commands' in result)
|
self.assert_(u'command: commands' in result)
|
||||||
self.assert_(u'command: play' in result)
|
self.assert_(u'command: play' in result)
|
||||||
self.assert_(u'command: status' in result)
|
self.assert_(u'command: status' in result)
|
||||||
|
# Check if commands you do not have access to are not present
|
||||||
|
self.assert_(u'command: kill' not in result)
|
||||||
# Check if the blacklisted commands are not present
|
# Check if the blacklisted commands are not present
|
||||||
self.assert_(u'command: command_list_begin' not in result)
|
self.assert_(u'command: command_list_begin' not in result)
|
||||||
self.assert_(u'command: command_list_ok_begin' not in result)
|
self.assert_(u'command: command_list_ok_begin' not in result)
|
||||||
@ -33,9 +35,10 @@ class ReflectionHandlerTest(unittest.TestCase):
|
|||||||
result = self.dispatcher.handle_request(u'decoders')
|
result = self.dispatcher.handle_request(u'decoders')
|
||||||
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
self.assert_(u'ACK [0@0] {} Not implemented' in result)
|
||||||
|
|
||||||
def test_notcommands_returns_only_ok(self):
|
def test_notcommands_returns_only_kill_and_ok(self):
|
||||||
result = self.dispatcher.handle_request(u'notcommands')
|
result = self.dispatcher.handle_request(u'notcommands')
|
||||||
self.assertEqual(1, len(result))
|
self.assertEqual(2, len(result))
|
||||||
|
self.assert_(u'command: kill' in result)
|
||||||
self.assert_(u'OK' in result)
|
self.assert_(u'OK' in result)
|
||||||
|
|
||||||
def test_tagtypes(self):
|
def test_tagtypes(self):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user