Return 'incorrect arguments' instead of 'unknown command' for known commands that don't match any patterns

This commit is contained in:
Stein Magnus Jodal 2010-06-23 22:53:27 +02:00
parent 0ee8254008
commit 2f9775250a
2 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,10 @@ class MpdFrontend(object):
matches = re.match(pattern, request)
if matches is not None:
return (_request_handlers[pattern], matches.groupdict())
raise MpdUnknownCommand(command=request.split(' ')[0])
command = request.split(' ')[0]
if command in _commands:
raise MpdArgError(u'incorrect arguments', command=command)
raise MpdUnknownCommand(command=command)
def handle_response(self, result, add_ok=True):
response = []

View File

@ -993,8 +993,7 @@ class MusicDatabaseHandlerTest(unittest.TestCase):
def test_list_artist_with_artist_should_fail(self):
result = self.h.handle_request(u'list "artist" "anartist"')
self.assertEqual(result[0],
u'ACK [2@0] {list} should be "Album" for 3 arguments')
self.assertEqual(result[0], u'ACK [2@0] {list} incorrect arguments')
def test_list_album_without_artist(self):
result = self.h.handle_request(u'list "album"')