Test behaviour when errors happens during command_list processing

This commit is contained in:
Stein Magnus Jodal 2010-02-14 01:54:03 +01:00
parent 39c44bfed6
commit 4e16e403d2
2 changed files with 15 additions and 0 deletions

View File

@ -70,6 +70,15 @@ class MpdHandler(object):
response.append(u'OK')
return response
@register(r'^ack$')
def _ack(self):
"""
Always returns an 'ACK' and not 'OK'.
Not a part of the MPD protocol.
"""
raise MpdNotImplemented
@register(r'^add "(?P<uri>[^"]*)"$')
def _add(self, uri):
raise MpdNotImplemented # TODO

View File

@ -66,6 +66,12 @@ class CommandListsTest(unittest.TestCase):
self.assert_(u'OK' in result)
self.assertEquals(False, self.h.command_list)
def test_command_list_with_error(self):
self.h.handle_request(u'command_list_begin')
self.h.handle_request(u'ack')
result = self.h.handle_request(u'command_list_end')
self.assert_(u'ACK' in result[-1])
def test_command_list_ok_begin(self):
result = self.h.handle_request(u'command_list_ok_begin')
self.assert_(result is None)