Return permission error on use of MPD command 'kill'
This commit is contained in:
parent
c84639b197
commit
7f7d79b21f
@ -1,6 +1,7 @@
|
||||
from mopidy import settings
|
||||
from mopidy.frontends.mpd.protocol import handle_pattern
|
||||
from mopidy.frontends.mpd.exceptions import MpdPasswordError
|
||||
from mopidy.frontends.mpd.exceptions import (MpdPasswordError,
|
||||
MpdPermissionError)
|
||||
|
||||
@handle_pattern(r'^close$')
|
||||
def close(context):
|
||||
@ -22,9 +23,7 @@ def kill(context):
|
||||
|
||||
Kills MPD.
|
||||
"""
|
||||
# TODO We do not want to allow remote killing of Mopidy. We should throw an
|
||||
# MPD exception here. Maybe using ACK_ERROR_PERMISSION.
|
||||
pass
|
||||
raise MpdPermissionError(command=u'kill')
|
||||
|
||||
@handle_pattern(r'^password "(?P<password>[^"]+)"$')
|
||||
def password_(context, password):
|
||||
|
||||
@ -31,7 +31,7 @@ class ConnectionHandlerTest(unittest.TestCase):
|
||||
|
||||
def test_kill(self):
|
||||
result = self.dispatcher.handle_request(u'kill')
|
||||
self.assert_(u'OK' in result)
|
||||
self.assert_(u'ACK [4@0] {kill} you don\'t have permission for "kill"' in result)
|
||||
|
||||
def test_valid_password_is_accepted(self):
|
||||
settings.MPD_SERVER_PASSWORD = u'topsecret'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user