diff --git a/tests/mpd/protocol/__init__.py b/tests/mpd/protocol/__init__.py index 4f6e697a..8c744a78 100644 --- a/tests/mpd/protocol/__init__.py +++ b/tests/mpd/protocol/__init__.py @@ -44,7 +44,7 @@ class BaseTestCase(unittest.TestCase): def tearDown(self): # noqa: N802 pykka.ActorRegistry.stop_all() - def sendRequest(self, request): + def send_request(self, request): self.connection.response = [] request = '%s\n' % request.encode('utf-8') self.session.on_receive({'received': request}) diff --git a/tests/mpd/protocol/test_audio_output.py b/tests/mpd/protocol/test_audio_output.py index 4815c2db..137ac029 100644 --- a/tests/mpd/protocol/test_audio_output.py +++ b/tests/mpd/protocol/test_audio_output.py @@ -7,26 +7,26 @@ class AudioOutputHandlerTest(protocol.BaseTestCase): def test_enableoutput(self): self.core.playback.mute = False - self.sendRequest('enableoutput "0"') + self.send_request('enableoutput "0"') self.assertInResponse('OK') self.assertEqual(self.core.playback.mute.get(), True) def test_enableoutput_unknown_outputid(self): - self.sendRequest('enableoutput "7"') + self.send_request('enableoutput "7"') self.assertInResponse('ACK [50@0] {enableoutput} No such audio output') def test_disableoutput(self): self.core.playback.mute = True - self.sendRequest('disableoutput "0"') + self.send_request('disableoutput "0"') self.assertInResponse('OK') self.assertEqual(self.core.playback.mute.get(), False) def test_disableoutput_unknown_outputid(self): - self.sendRequest('disableoutput "7"') + self.send_request('disableoutput "7"') self.assertInResponse( 'ACK [50@0] {disableoutput} No such audio output') @@ -34,7 +34,7 @@ class AudioOutputHandlerTest(protocol.BaseTestCase): def test_outputs_when_unmuted(self): self.core.playback.mute = False - self.sendRequest('outputs') + self.send_request('outputs') self.assertInResponse('outputid: 0') self.assertInResponse('outputname: Mute') @@ -44,7 +44,7 @@ class AudioOutputHandlerTest(protocol.BaseTestCase): def test_outputs_when_muted(self): self.core.playback.mute = True - self.sendRequest('outputs') + self.send_request('outputs') self.assertInResponse('outputid: 0') self.assertInResponse('outputname: Mute') diff --git a/tests/mpd/protocol/test_authentication.py b/tests/mpd/protocol/test_authentication.py index 6785ff98..ac6e71da 100644 --- a/tests/mpd/protocol/test_authentication.py +++ b/tests/mpd/protocol/test_authentication.py @@ -10,53 +10,53 @@ class AuthenticationActiveTest(protocol.BaseTestCase): return config def test_authentication_with_valid_password_is_accepted(self): - self.sendRequest('password "topsecret"') + self.send_request('password "topsecret"') self.assertTrue(self.dispatcher.authenticated) self.assertInResponse('OK') def test_authentication_with_invalid_password_is_not_accepted(self): - self.sendRequest('password "secret"') + self.send_request('password "secret"') self.assertFalse(self.dispatcher.authenticated) self.assertEqualResponse('ACK [3@0] {password} incorrect password') def test_authentication_without_password_fails(self): - self.sendRequest('password') + self.send_request('password') self.assertFalse(self.dispatcher.authenticated) self.assertEqualResponse( 'ACK [2@0] {password} wrong number of arguments for "password"') def test_anything_when_not_authenticated_should_fail(self): - self.sendRequest('any request at all') + self.send_request('any request at all') self.assertFalse(self.dispatcher.authenticated) self.assertEqualResponse( u'ACK [4@0] {any} you don\'t have permission for "any"') def test_close_is_allowed_without_authentication(self): - self.sendRequest('close') + self.send_request('close') self.assertFalse(self.dispatcher.authenticated) def test_commands_is_allowed_without_authentication(self): - self.sendRequest('commands') + self.send_request('commands') self.assertFalse(self.dispatcher.authenticated) self.assertInResponse('OK') def test_notcommands_is_allowed_without_authentication(self): - self.sendRequest('notcommands') + self.send_request('notcommands') self.assertFalse(self.dispatcher.authenticated) self.assertInResponse('OK') def test_ping_is_allowed_without_authentication(self): - self.sendRequest('ping') + self.send_request('ping') self.assertFalse(self.dispatcher.authenticated) self.assertInResponse('OK') class AuthenticationInactiveTest(protocol.BaseTestCase): def test_authentication_with_anything_when_password_check_turned_off(self): - self.sendRequest('any request at all') + self.send_request('any request at all') self.assertTrue(self.dispatcher.authenticated) self.assertEqualResponse('ACK [5@0] {} unknown command "any"') def test_any_password_is_not_accepted_when_password_check_turned_off(self): - self.sendRequest('password "secret"') + self.send_request('password "secret"') self.assertEqualResponse('ACK [3@0] {password} incorrect password') diff --git a/tests/mpd/protocol/test_channels.py b/tests/mpd/protocol/test_channels.py index 1c04974e..c29b2b57 100644 --- a/tests/mpd/protocol/test_channels.py +++ b/tests/mpd/protocol/test_channels.py @@ -5,21 +5,21 @@ from tests.mpd import protocol class ChannelsHandlerTest(protocol.BaseTestCase): def test_subscribe(self): - self.sendRequest('subscribe "topic"') + self.send_request('subscribe "topic"') self.assertEqualResponse('ACK [0@0] {subscribe} Not implemented') def test_unsubscribe(self): - self.sendRequest('unsubscribe "topic"') + self.send_request('unsubscribe "topic"') self.assertEqualResponse('ACK [0@0] {unsubscribe} Not implemented') def test_channels(self): - self.sendRequest('channels') + self.send_request('channels') self.assertEqualResponse('ACK [0@0] {channels} Not implemented') def test_readmessages(self): - self.sendRequest('readmessages') + self.send_request('readmessages') self.assertEqualResponse('ACK [0@0] {readmessages} Not implemented') def test_sendmessage(self): - self.sendRequest('sendmessage "topic" "a message"') + self.send_request('sendmessage "topic" "a message"') self.assertEqualResponse('ACK [0@0] {sendmessage} Not implemented') diff --git a/tests/mpd/protocol/test_command_list.py b/tests/mpd/protocol/test_command_list.py index 330af176..28642b47 100644 --- a/tests/mpd/protocol/test_command_list.py +++ b/tests/mpd/protocol/test_command_list.py @@ -5,55 +5,55 @@ from tests.mpd import protocol class CommandListsTest(protocol.BaseTestCase): def test_command_list_begin(self): - response = self.sendRequest('command_list_begin') + response = self.send_request('command_list_begin') self.assertEquals([], response) def test_command_list_end(self): - self.sendRequest('command_list_begin') - self.sendRequest('command_list_end') + self.send_request('command_list_begin') + self.send_request('command_list_end') self.assertInResponse('OK') def test_command_list_end_without_start_first_is_an_unknown_command(self): - self.sendRequest('command_list_end') + self.send_request('command_list_end') self.assertEqualResponse( 'ACK [5@0] {} unknown command "command_list_end"') def test_command_list_with_ping(self): - self.sendRequest('command_list_begin') + self.send_request('command_list_begin') self.assertTrue(self.dispatcher.command_list_receiving) self.assertFalse(self.dispatcher.command_list_ok) self.assertEqual([], self.dispatcher.command_list) - self.sendRequest('ping') + self.send_request('ping') self.assertIn('ping', self.dispatcher.command_list) - self.sendRequest('command_list_end') + self.send_request('command_list_end') self.assertInResponse('OK') self.assertFalse(self.dispatcher.command_list_receiving) self.assertFalse(self.dispatcher.command_list_ok) self.assertEqual([], self.dispatcher.command_list) def test_command_list_with_error_returns_ack_with_correct_index(self): - self.sendRequest('command_list_begin') - self.sendRequest('play') # Known command - self.sendRequest('paly') # Unknown command - self.sendRequest('command_list_end') + self.send_request('command_list_begin') + self.send_request('play') # Known command + self.send_request('paly') # Unknown command + self.send_request('command_list_end') self.assertEqualResponse('ACK [5@1] {} unknown command "paly"') def test_command_list_ok_begin(self): - response = self.sendRequest('command_list_ok_begin') + response = self.send_request('command_list_ok_begin') self.assertEquals([], response) def test_command_list_ok_with_ping(self): - self.sendRequest('command_list_ok_begin') + self.send_request('command_list_ok_begin') self.assertTrue(self.dispatcher.command_list_receiving) self.assertTrue(self.dispatcher.command_list_ok) self.assertEqual([], self.dispatcher.command_list) - self.sendRequest('ping') + self.send_request('ping') self.assertIn('ping', self.dispatcher.command_list) - self.sendRequest('command_list_end') + self.send_request('command_list_end') self.assertInResponse('list_OK') self.assertInResponse('OK') self.assertFalse(self.dispatcher.command_list_receiving) diff --git a/tests/mpd/protocol/test_connection.py b/tests/mpd/protocol/test_connection.py index 2a21a1c3..da25153d 100644 --- a/tests/mpd/protocol/test_connection.py +++ b/tests/mpd/protocol/test_connection.py @@ -8,22 +8,22 @@ from tests.mpd import protocol class ConnectionHandlerTest(protocol.BaseTestCase): def test_close_closes_the_client_connection(self): with patch.object(self.session, 'close') as close_mock: - self.sendRequest('close') + self.send_request('close') close_mock.assertEqualResponsecalled_once_with() self.assertEqualResponse('OK') def test_empty_request(self): - self.sendRequest('') + self.send_request('') self.assertEqualResponse('ACK [5@0] {} No command given') - self.sendRequest(' ') + self.send_request(' ') self.assertEqualResponse('ACK [5@0] {} No command given') def test_kill(self): - self.sendRequest('kill') + self.send_request('kill') self.assertEqualResponse( 'ACK [4@0] {kill} you don\'t have permission for "kill"') def test_ping(self): - self.sendRequest('ping') + self.send_request('ping') self.assertEqualResponse('OK') diff --git a/tests/mpd/protocol/test_current_playlist.py b/tests/mpd/protocol/test_current_playlist.py index 6501e5c7..d6fdce8e 100644 --- a/tests/mpd/protocol/test_current_playlist.py +++ b/tests/mpd/protocol/test_current_playlist.py @@ -14,13 +14,13 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('add "dummy://foo"') + self.send_request('add "dummy://foo"') self.assertEqual(len(self.core.tracklist.tracks.get()), 6) self.assertEqual(self.core.tracklist.tracks.get()[5], needle) self.assertEqualResponse('OK') def test_add_with_uri_not_found_in_library_should_ack(self): - self.sendRequest('add "dummy://foo"') + self.send_request('add "dummy://foo"') self.assertEqualResponse( 'ACK [50@0] {add} directory or file not found') @@ -29,7 +29,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.backend.library.dummy_browse_result = { 'dummy:/': [Ref.track(uri='dummy:/a', name='a')]} - self.sendRequest('add ""') + self.send_request('add ""') self.assertEqual(len(self.core.tracklist.tracks.get()), 0) self.assertInResponse('OK') @@ -43,7 +43,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]} - self.sendRequest('add "/dummy"') + self.send_request('add "/dummy"') self.assertEqual(self.core.tracklist.tracks.get(), tracks) self.assertInResponse('OK') @@ -52,7 +52,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.backend.library.dummy_browse_result = { 'dummy:/': [Ref.track(uri='dummy:/a', name='a')]} - self.sendRequest('add "/"') + self.send_request('add "/"') self.assertEqual(len(self.core.tracklist.tracks.get()), 0) self.assertInResponse('OK') @@ -64,7 +64,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('addid "dummy://foo"') + self.send_request('addid "dummy://foo"') self.assertEqual(len(self.core.tracklist.tracks.get()), 6) self.assertEqual(self.core.tracklist.tracks.get()[5], needle) self.assertInResponse( @@ -72,7 +72,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_addid_with_empty_uri_acks(self): - self.sendRequest('addid ""') + self.send_request('addid ""') self.assertEqualResponse('ACK [50@0] {addid} No such song') def test_addid_with_songpos(self): @@ -83,7 +83,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('addid "dummy://foo" "3"') + self.send_request('addid "dummy://foo" "3"') self.assertEqual(len(self.core.tracklist.tracks.get()), 6) self.assertEqual(self.core.tracklist.tracks.get()[3], needle) self.assertInResponse( @@ -98,11 +98,11 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('addid "dummy://foo" "6"') + self.send_request('addid "dummy://foo" "6"') self.assertEqualResponse('ACK [2@0] {addid} Bad song index') def test_addid_with_uri_not_found_in_library_should_ack(self): - self.sendRequest('addid "dummy://foo"') + self.send_request('addid "dummy://foo"') self.assertEqualResponse('ACK [50@0] {addid} No such song') def test_clear(self): @@ -110,7 +110,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('clear') + self.send_request('clear') self.assertEqual(len(self.core.tracklist.tracks.get()), 0) self.assertEqual(self.core.playback.current_track.get(), None) self.assertInResponse('OK') @@ -120,7 +120,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest( + self.send_request( 'delete "%d"' % self.core.tracklist.tl_tracks.get()[2].tlid) self.assertEqual(len(self.core.tracklist.tracks.get()), 4) self.assertInResponse('OK') @@ -130,7 +130,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('delete "5"') + self.send_request('delete "5"') self.assertEqual(len(self.core.tracklist.tracks.get()), 5) self.assertEqualResponse('ACK [2@0] {delete} Bad song index') @@ -139,7 +139,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('delete "1:"') + self.send_request('delete "1:"') self.assertEqual(len(self.core.tracklist.tracks.get()), 1) self.assertInResponse('OK') @@ -148,7 +148,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('delete "1:3"') + self.send_request('delete "1:3"') self.assertEqual(len(self.core.tracklist.tracks.get()), 3) self.assertInResponse('OK') @@ -157,7 +157,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(), Track(), Track(), Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 5) - self.sendRequest('delete "5:7"') + self.send_request('delete "5:7"') self.assertEqual(len(self.core.tracklist.tracks.get()), 5) self.assertEqualResponse('ACK [2@0] {delete} Bad song index') @@ -165,7 +165,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 2) - self.sendRequest('deleteid "1"') + self.send_request('deleteid "1"') self.assertEqual(len(self.core.tracklist.tracks.get()), 1) self.assertInResponse('OK') @@ -173,7 +173,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([Track(), Track()]) self.assertEqual(len(self.core.tracklist.tracks.get()), 2) - self.sendRequest('deleteid "12345"') + self.send_request('deleteid "12345"') self.assertEqual(len(self.core.tracklist.tracks.get()), 2) self.assertEqualResponse('ACK [50@0] {deleteid} No such song') @@ -183,7 +183,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('move "1" "0"') + self.send_request('move "1" "0"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'b') self.assertEqual(tracks[1].name, 'a') @@ -199,7 +199,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('move "2:" "0"') + self.send_request('move "2:" "0"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'c') self.assertEqual(tracks[1].name, 'd') @@ -215,7 +215,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('move "1:3" "0"') + self.send_request('move "1:3" "0"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'b') self.assertEqual(tracks[1].name, 'c') @@ -231,7 +231,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('moveid "4" "2"') + self.send_request('moveid "4" "2"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'a') self.assertEqual(tracks[1].name, 'b') @@ -242,31 +242,31 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_moveid_with_tlid_not_found_in_tracklist_should_ack(self): - self.sendRequest('moveid "9" "0"') + self.send_request('moveid "9" "0"') self.assertEqualResponse( 'ACK [50@0] {moveid} No such song') def test_playlist_returns_same_as_playlistinfo(self): - playlist_response = self.sendRequest('playlist') - playlistinfo_response = self.sendRequest('playlistinfo') + playlist_response = self.send_request('playlist') + playlistinfo_response = self.send_request('playlistinfo') self.assertEqual(playlist_response, playlistinfo_response) def test_playlistfind(self): - self.sendRequest('playlistfind "tag" "needle"') + self.send_request('playlistfind "tag" "needle"') self.assertEqualResponse('ACK [0@0] {playlistfind} Not implemented') def test_playlistfind_by_filename_not_in_tracklist(self): - self.sendRequest('playlistfind "filename" "file:///dev/null"') + self.send_request('playlistfind "filename" "file:///dev/null"') self.assertEqualResponse('OK') def test_playlistfind_by_filename_without_quotes(self): - self.sendRequest('playlistfind filename "file:///dev/null"') + self.send_request('playlistfind filename "file:///dev/null"') self.assertEqualResponse('OK') def test_playlistfind_by_filename_in_tracklist(self): self.core.tracklist.add([Track(uri='file:///exists')]) - self.sendRequest('playlistfind filename "file:///exists"') + self.send_request('playlistfind filename "file:///exists"') self.assertInResponse('file: file:///exists') self.assertInResponse('Id: 0') self.assertInResponse('Pos: 0') @@ -275,7 +275,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): def test_playlistid_without_songid(self): self.core.tracklist.add([Track(name='a'), Track(name='b')]) - self.sendRequest('playlistid') + self.send_request('playlistid') self.assertInResponse('Title: a') self.assertInResponse('Title: b') self.assertInResponse('OK') @@ -283,7 +283,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): def test_playlistid_with_songid(self): self.core.tracklist.add([Track(name='a'), Track(name='b')]) - self.sendRequest('playlistid "1"') + self.send_request('playlistid "1"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Id: 0') self.assertInResponse('Title: b') @@ -293,7 +293,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): def test_playlistid_with_not_existing_songid_fails(self): self.core.tracklist.add([Track(name='a'), Track(name='b')]) - self.sendRequest('playlistid "25"') + self.send_request('playlistid "25"') self.assertEqualResponse('ACK [50@0] {playlistid} No such song') def test_playlistinfo_without_songpos_or_range(self): @@ -302,7 +302,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('playlistinfo') + self.send_request('playlistinfo') self.assertInResponse('Title: a') self.assertInResponse('Pos: 0') self.assertInResponse('Title: b') @@ -325,7 +325,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('playlistinfo "4"') + self.send_request('playlistinfo "4"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Pos: 0') self.assertNotInResponse('Title: b') @@ -341,8 +341,8 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_playlistinfo_with_negative_songpos_same_as_playlistinfo(self): - response1 = self.sendRequest('playlistinfo "-1"') - response2 = self.sendRequest('playlistinfo') + response1 = self.send_request('playlistinfo "-1"') + response2 = self.send_request('playlistinfo') self.assertEqual(response1, response2) def test_playlistinfo_with_open_range(self): @@ -351,7 +351,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('playlistinfo "2:"') + self.send_request('playlistinfo "2:"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Pos: 0') self.assertNotInResponse('Title: b') @@ -372,7 +372,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('playlistinfo "2:4"') + self.send_request('playlistinfo "2:4"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Title: b') self.assertInResponse('Title: c') @@ -382,30 +382,30 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_playlistinfo_with_too_high_start_of_range_returns_arg_error(self): - self.sendRequest('playlistinfo "10:20"') + self.send_request('playlistinfo "10:20"') self.assertEqualResponse('ACK [2@0] {playlistinfo} Bad song index') def test_playlistinfo_with_too_high_end_of_range_returns_ok(self): - self.sendRequest('playlistinfo "0:20"') + self.send_request('playlistinfo "0:20"') self.assertInResponse('OK') def test_playlistinfo_with_zero_returns_ok(self): - self.sendRequest('playlistinfo "0"') + self.send_request('playlistinfo "0"') self.assertInResponse('OK') def test_playlistsearch(self): - self.sendRequest('playlistsearch "any" "needle"') + self.send_request('playlistsearch "any" "needle"') self.assertEqualResponse('ACK [0@0] {playlistsearch} Not implemented') def test_playlistsearch_without_quotes(self): - self.sendRequest('playlistsearch any "needle"') + self.send_request('playlistsearch any "needle"') self.assertEqualResponse('ACK [0@0] {playlistsearch} Not implemented') def test_plchanges_with_lower_version_returns_changes(self): self.core.tracklist.add( [Track(name='a'), Track(name='b'), Track(name='c')]) - self.sendRequest('plchanges "0"') + self.send_request('plchanges "0"') self.assertInResponse('Title: a') self.assertInResponse('Title: b') self.assertInResponse('Title: c') @@ -416,7 +416,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(name='a'), Track(name='b'), Track(name='c')]) self.assertEqual(self.core.tracklist.version.get(), 1) - self.sendRequest('plchanges "1"') + self.send_request('plchanges "1"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Title: b') self.assertNotInResponse('Title: c') @@ -427,7 +427,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): [Track(name='a'), Track(name='b'), Track(name='c')]) self.assertEqual(self.core.tracklist.version.get(), 1) - self.sendRequest('plchanges "2"') + self.send_request('plchanges "2"') self.assertNotInResponse('Title: a') self.assertNotInResponse('Title: b') self.assertNotInResponse('Title: c') @@ -437,7 +437,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.core.tracklist.add( [Track(name='a'), Track(name='b'), Track(name='c')]) - self.sendRequest('plchanges "-1"') + self.send_request('plchanges "-1"') self.assertInResponse('Title: a') self.assertInResponse('Title: b') self.assertInResponse('Title: c') @@ -447,7 +447,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): self.core.tracklist.add( [Track(name='a'), Track(name='b'), Track(name='c')]) - self.sendRequest('plchanges 0') + self.send_request('plchanges 0') self.assertInResponse('Title: a') self.assertInResponse('Title: b') self.assertInResponse('Title: c') @@ -456,7 +456,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): def test_plchangesposid(self): self.core.tracklist.add([Track(), Track(), Track()]) - self.sendRequest('plchangesposid "0"') + self.send_request('plchangesposid "0"') tl_tracks = self.core.tracklist.tl_tracks.get() self.assertInResponse('cpos: 0') self.assertInResponse('Id: %d' % tl_tracks[0].tlid) @@ -473,7 +473,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): ]) version = self.core.tracklist.version.get() - self.sendRequest('shuffle') + self.send_request('shuffle') self.assertLess(version, self.core.tracklist.version.get()) self.assertInResponse('OK') @@ -484,7 +484,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): ]) version = self.core.tracklist.version.get() - self.sendRequest('shuffle "4:"') + self.send_request('shuffle "4:"') self.assertLess(version, self.core.tracklist.version.get()) tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'a') @@ -500,7 +500,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): ]) version = self.core.tracklist.version.get() - self.sendRequest('shuffle "1:3"') + self.send_request('shuffle "1:3"') self.assertLess(version, self.core.tracklist.version.get()) tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'a') @@ -515,7 +515,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('swap "1" "4"') + self.send_request('swap "1" "4"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'a') self.assertEqual(tracks[1].name, 'e') @@ -531,7 +531,7 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): Track(name='d'), Track(name='e'), Track(name='f'), ]) - self.sendRequest('swapid "1" "4"') + self.send_request('swapid "1" "4"') tracks = self.core.tracklist.tracks.get() self.assertEqual(tracks[0].name, 'a') self.assertEqual(tracks[1].name, 'e') @@ -543,12 +543,12 @@ class CurrentPlaylistHandlerTest(protocol.BaseTestCase): def test_swapid_with_first_id_unknown_should_ack(self): self.core.tracklist.add([Track()]) - self.sendRequest('swapid "0" "4"') + self.send_request('swapid "0" "4"') self.assertEqualResponse( 'ACK [50@0] {swapid} No such song') def test_swapid_with_second_id_unknown_should_ack(self): self.core.tracklist.add([Track()]) - self.sendRequest('swapid "4" "0"') + self.send_request('swapid "4" "0"') self.assertEqualResponse( 'ACK [50@0] {swapid} No such song') diff --git a/tests/mpd/protocol/test_idle.py b/tests/mpd/protocol/test_idle.py index 3af983e2..0bd16992 100644 --- a/tests/mpd/protocol/test_idle.py +++ b/tests/mpd/protocol/test_idle.py @@ -8,7 +8,7 @@ from tests.mpd import protocol class IdleHandlerTest(protocol.BaseTestCase): - def idleEvent(self, subsystem): + def idle_event(self, subsystem): self.session.on_idle(subsystem) def assertEqualEvents(self, events): # noqa: N802 @@ -29,96 +29,96 @@ class IdleHandlerTest(protocol.BaseTestCase): self.assertNoResponse() def test_idle(self): - self.sendRequest('idle') + self.send_request('idle') self.assertEqualSubscriptions(SUBSYSTEMS) self.assertNoEvents() self.assertNoResponse() def test_idle_disables_timeout(self): - self.sendRequest('idle') + self.send_request('idle') self.connection.disable_timeout.assert_called_once_with() def test_noidle(self): - self.sendRequest('noidle') + self.send_request('noidle') self.assertNoSubscriptions() self.assertNoEvents() self.assertNoResponse() def test_idle_player(self): - self.sendRequest('idle player') + self.send_request('idle player') self.assertEqualSubscriptions(['player']) self.assertNoEvents() self.assertNoResponse() def test_idle_player_playlist(self): - self.sendRequest('idle player playlist') + self.send_request('idle player playlist') self.assertEqualSubscriptions(['player', 'playlist']) self.assertNoEvents() self.assertNoResponse() def test_idle_then_noidle(self): - self.sendRequest('idle') - self.sendRequest('noidle') + self.send_request('idle') + self.send_request('noidle') self.assertNoSubscriptions() self.assertNoEvents() self.assertOnceInResponse('OK') def test_idle_then_noidle_enables_timeout(self): - self.sendRequest('idle') - self.sendRequest('noidle') + self.send_request('idle') + self.send_request('noidle') self.connection.enable_timeout.assert_called_once_with() def test_idle_then_play(self): with patch.object(self.session, 'stop') as stop_mock: - self.sendRequest('idle') - self.sendRequest('play') + self.send_request('idle') + self.send_request('play') stop_mock.assert_called_once_with() def test_idle_then_idle(self): with patch.object(self.session, 'stop') as stop_mock: - self.sendRequest('idle') - self.sendRequest('idle') + self.send_request('idle') + self.send_request('idle') stop_mock.assert_called_once_with() def test_idle_player_then_play(self): with patch.object(self.session, 'stop') as stop_mock: - self.sendRequest('idle player') - self.sendRequest('play') + self.send_request('idle player') + self.send_request('play') stop_mock.assert_called_once_with() def test_idle_then_player(self): - self.sendRequest('idle') - self.idleEvent('player') + self.send_request('idle') + self.idle_event('player') self.assertNoSubscriptions() self.assertNoEvents() self.assertOnceInResponse('changed: player') self.assertOnceInResponse('OK') def test_idle_player_then_event_player(self): - self.sendRequest('idle player') - self.idleEvent('player') + self.send_request('idle player') + self.idle_event('player') self.assertNoSubscriptions() self.assertNoEvents() self.assertOnceInResponse('changed: player') self.assertOnceInResponse('OK') def test_idle_player_then_noidle(self): - self.sendRequest('idle player') - self.sendRequest('noidle') + self.send_request('idle player') + self.send_request('noidle') self.assertNoSubscriptions() self.assertNoEvents() self.assertOnceInResponse('OK') def test_idle_player_playlist_then_noidle(self): - self.sendRequest('idle player playlist') - self.sendRequest('noidle') + self.send_request('idle player playlist') + self.send_request('noidle') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('OK') def test_idle_player_playlist_then_player(self): - self.sendRequest('idle player playlist') - self.idleEvent('player') + self.send_request('idle player playlist') + self.idle_event('player') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('changed: player') @@ -126,16 +126,16 @@ class IdleHandlerTest(protocol.BaseTestCase): self.assertOnceInResponse('OK') def test_idle_playlist_then_player(self): - self.sendRequest('idle playlist') - self.idleEvent('player') + self.send_request('idle playlist') + self.idle_event('player') self.assertEqualEvents(['player']) self.assertEqualSubscriptions(['playlist']) self.assertNoResponse() def test_idle_playlist_then_player_then_playlist(self): - self.sendRequest('idle playlist') - self.idleEvent('player') - self.idleEvent('playlist') + self.send_request('idle playlist') + self.idle_event('player') + self.idle_event('playlist') self.assertNoEvents() self.assertNoSubscriptions() self.assertNotInResponse('changed: player') @@ -143,14 +143,14 @@ class IdleHandlerTest(protocol.BaseTestCase): self.assertOnceInResponse('OK') def test_player(self): - self.idleEvent('player') + self.idle_event('player') self.assertEqualEvents(['player']) self.assertNoSubscriptions() self.assertNoResponse() def test_player_then_idle_player(self): - self.idleEvent('player') - self.sendRequest('idle player') + self.idle_event('player') + self.send_request('idle player') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('changed: player') @@ -158,24 +158,24 @@ class IdleHandlerTest(protocol.BaseTestCase): self.assertOnceInResponse('OK') def test_player_then_playlist(self): - self.idleEvent('player') - self.idleEvent('playlist') + self.idle_event('player') + self.idle_event('playlist') self.assertEqualEvents(['player', 'playlist']) self.assertNoSubscriptions() self.assertNoResponse() def test_player_then_idle(self): - self.idleEvent('player') - self.sendRequest('idle') + self.idle_event('player') + self.send_request('idle') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('changed: player') self.assertOnceInResponse('OK') def test_player_then_playlist_then_idle(self): - self.idleEvent('player') - self.idleEvent('playlist') - self.sendRequest('idle') + self.idle_event('player') + self.idle_event('playlist') + self.send_request('idle') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('changed: player') @@ -183,24 +183,24 @@ class IdleHandlerTest(protocol.BaseTestCase): self.assertOnceInResponse('OK') def test_player_then_idle_playlist(self): - self.idleEvent('player') - self.sendRequest('idle playlist') + self.idle_event('player') + self.send_request('idle playlist') self.assertEqualEvents(['player']) self.assertEqualSubscriptions(['playlist']) self.assertNoResponse() def test_player_then_idle_playlist_then_noidle(self): - self.idleEvent('player') - self.sendRequest('idle playlist') - self.sendRequest('noidle') + self.idle_event('player') + self.send_request('idle playlist') + self.send_request('noidle') self.assertNoEvents() self.assertNoSubscriptions() self.assertOnceInResponse('OK') def test_player_then_playlist_then_idle_playlist(self): - self.idleEvent('player') - self.idleEvent('playlist') - self.sendRequest('idle playlist') + self.idle_event('player') + self.idle_event('playlist') + self.send_request('idle playlist') self.assertNoEvents() self.assertNoSubscriptions() self.assertNotInResponse('changed: player') diff --git a/tests/mpd/protocol/test_music_db.py b/tests/mpd/protocol/test_music_db.py index 30907bce..9f3b7348 100644 --- a/tests/mpd/protocol/test_music_db.py +++ b/tests/mpd/protocol/test_music_db.py @@ -34,19 +34,19 @@ class QueryFromMpdListFormatTest(unittest.TestCase): class MusicDatabaseHandlerTest(protocol.BaseTestCase): def test_count(self): - self.sendRequest('count "artist" "needle"') + self.send_request('count "artist" "needle"') self.assertInResponse('songs: 0') self.assertInResponse('playtime: 0') self.assertInResponse('OK') def test_count_without_quotes(self): - self.sendRequest('count artist "needle"') + self.send_request('count artist "needle"') self.assertInResponse('songs: 0') self.assertInResponse('playtime: 0') self.assertInResponse('OK') def test_count_with_multiple_pairs(self): - self.sendRequest('count "artist" "foo" "album" "bar"') + self.send_request('count "artist" "foo" "album" "bar"') self.assertInResponse('songs: 0') self.assertInResponse('playtime: 0') self.assertInResponse('OK') @@ -57,7 +57,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): tracks=[ Track(uri='dummy:a', name="foo", date="2001", length=4000), ]) - self.sendRequest('count "title" "foo"') + self.send_request('count "title" "foo"') self.assertInResponse('songs: 1') self.assertInResponse('playtime: 4') self.assertInResponse('OK') @@ -68,7 +68,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): Track(uri='dummy:b', date="2001", length=50000), Track(uri='dummy:c', date="2001", length=600000), ]) - self.sendRequest('count "date" "2001"') + self.send_request('count "date" "2001"') self.assertInResponse('songs: 2') self.assertInResponse('playtime: 650') self.assertInResponse('OK') @@ -78,7 +78,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): tracks=[Track(uri='dummy:a', name='A')]) self.assertEqual(self.core.tracklist.length.get(), 0) - self.sendRequest('findadd "title" "A"') + self.send_request('findadd "title" "A"') self.assertEqual(self.core.tracklist.length.get(), 1) self.assertEqual(self.core.tracklist.tracks.get()[0].uri, 'dummy:a') @@ -89,7 +89,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): tracks=[Track(uri='dummy:a', name='A')]) self.assertEqual(self.core.tracklist.length.get(), 0) - self.sendRequest('searchadd "title" "a"') + self.send_request('searchadd "title" "a"') self.assertEqual(self.core.tracklist.length.get(), 1) self.assertEqual(self.core.tracklist.tracks.get()[0].uri, 'dummy:a') @@ -108,7 +108,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertEqual(len(playlists), 1) self.assertEqual(len(playlists[0].tracks), 2) - self.sendRequest('searchaddpl "my favs" "title" "a"') + self.send_request('searchaddpl "my favs" "title" "a"') playlists = self.core.playlists.filter(name='my favs').get() self.assertEqual(len(playlists), 1) @@ -124,7 +124,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertEqual( len(self.core.playlists.filter(name='my favs').get()), 0) - self.sendRequest('searchaddpl "my favs" "title" "a"') + self.send_request('searchaddpl "my favs" "title" "a"') playlists = self.core.playlists.filter(name='my favs').get() self.assertEqual(len(playlists), 1) @@ -143,7 +143,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): Ref.playlist(uri='dummy:/pl', name='pl')], 'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]} - self.sendRequest('listall') + self.send_request('listall') self.assertInResponse('file: dummy:/a') self.assertInResponse('directory: /dummy/foo') @@ -162,7 +162,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]} - self.sendRequest('listall "/dummy/foo"') + self.send_request('listall "/dummy/foo"') self.assertNotInResponse('file: dummy:/a') self.assertInResponse('directory: /dummy/foo') @@ -170,7 +170,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_listall_with_unknown_uri(self): - self.sendRequest('listall "/unknown"') + self.send_request('listall "/unknown"') self.assertEqualResponse('ACK [50@0] {listall} Not found') @@ -179,8 +179,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('listall "dummy"') - response2 = self.sendRequest('listall "/dummy"') + response1 = self.send_request('listall "dummy"') + response2 = self.send_request('listall "/dummy"') self.assertEqual(response1, response2) def test_listall_for_dir_with_and_without_trailing_slash_is_the_same(self): @@ -188,8 +188,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('listall "dummy"') - response2 = self.sendRequest('listall "dummy/"') + response1 = self.send_request('listall "dummy"') + response2 = self.send_request('listall "dummy/"') self.assertEqual(response1, response2) def test_listall_duplicate(self): @@ -197,7 +197,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.directory(uri='dummy:/a1', name='a'), Ref.directory(uri='dummy:/a2', name='a')]} - self.sendRequest('listall') + self.send_request('listall') self.assertInResponse('directory: /dummy/a') self.assertInResponse('directory: /dummy/a [2]') @@ -213,7 +213,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): Ref.playlist(uri='dummy:/pl', name='pl')], 'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]} - self.sendRequest('listallinfo') + self.send_request('listallinfo') self.assertInResponse('file: dummy:/a') self.assertInResponse('Title: a') @@ -234,7 +234,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/foo/b', name='b')]} - self.sendRequest('listallinfo "/dummy/foo"') + self.send_request('listallinfo "/dummy/foo"') self.assertNotInResponse('file: dummy:/a') self.assertNotInResponse('Title: a') @@ -244,7 +244,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_listallinfo_with_unknown_uri(self): - self.sendRequest('listallinfo "/unknown"') + self.send_request('listallinfo "/unknown"') self.assertEqualResponse('ACK [50@0] {listallinfo} Not found') @@ -253,8 +253,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('listallinfo "dummy"') - response2 = self.sendRequest('listallinfo "/dummy"') + response1 = self.send_request('listallinfo "dummy"') + response2 = self.send_request('listallinfo "/dummy"') self.assertEqual(response1, response2) def test_listallinfo_for_dir_with_and_without_trailing_slash_is_same(self): @@ -262,8 +262,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('listallinfo "dummy"') - response2 = self.sendRequest('listallinfo "dummy/"') + response1 = self.send_request('listallinfo "dummy"') + response2 = self.send_request('listallinfo "dummy/"') self.assertEqual(response1, response2) def test_listallinfo_duplicate(self): @@ -271,7 +271,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.directory(uri='dummy:/a1', name='a'), Ref.directory(uri='dummy:/a2', name='a')]} - self.sendRequest('listallinfo') + self.send_request('listallinfo') self.assertInResponse('directory: /dummy/a') self.assertInResponse('directory: /dummy/a [2]') @@ -280,8 +280,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='a', uri='dummy:/a', last_modified=last_modified)] - response1 = self.sendRequest('lsinfo') - response2 = self.sendRequest('lsinfo "/"') + response1 = self.send_request('lsinfo') + response2 = self.send_request('lsinfo "/"') self.assertEqual(response1, response2) def test_lsinfo_with_empty_path_returns_same_as_for_root(self): @@ -289,8 +289,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='a', uri='dummy:/a', last_modified=last_modified)] - response1 = self.sendRequest('lsinfo ""') - response2 = self.sendRequest('lsinfo "/"') + response1 = self.send_request('lsinfo ""') + response2 = self.send_request('lsinfo "/"') self.assertEqual(response1, response2) def test_lsinfo_for_root_includes_playlists(self): @@ -298,7 +298,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='a', uri='dummy:/a', last_modified=last_modified)] - self.sendRequest('lsinfo "/"') + self.send_request('lsinfo "/"') self.assertInResponse('playlist: a') # Date without milliseconds and with time zone information self.assertInResponse('Last-Modified: 2014-01-28T21:01:13Z') @@ -309,7 +309,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - self.sendRequest('lsinfo "/"') + self.send_request('lsinfo "/"') self.assertInResponse('directory: dummy') self.assertInResponse('OK') @@ -318,8 +318,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('lsinfo "dummy"') - response2 = self.sendRequest('lsinfo "/dummy"') + response1 = self.send_request('lsinfo "dummy"') + response2 = self.send_request('lsinfo "/dummy"') self.assertEqual(response1, response2) def test_lsinfo_for_dir_with_and_without_trailing_slash_is_the_same(self): @@ -327,8 +327,8 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.track(uri='dummy:/a', name='a'), Ref.directory(uri='dummy:/foo', name='foo')]} - response1 = self.sendRequest('lsinfo "dummy"') - response2 = self.sendRequest('lsinfo "dummy/"') + response1 = self.send_request('lsinfo "dummy"') + response2 = self.send_request('lsinfo "dummy/"') self.assertEqual(response1, response2) def test_lsinfo_for_dir_includes_tracks(self): @@ -338,7 +338,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.library.dummy_browse_result = { 'dummy:/': [Ref.track(uri='dummy:/a', name='a')]} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertInResponse('file: dummy:/a') self.assertInResponse('Title: a') self.assertInResponse('OK') @@ -347,7 +347,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.library.dummy_browse_result = { 'dummy:/': [Ref.directory(uri='dummy:/foo', name='foo')]} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertInResponse('directory: dummy/foo') self.assertInResponse('OK') @@ -355,7 +355,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.library.dummy_browse_result = { 'dummy:/': []} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertInResponse('OK') def test_lsinfo_for_dir_does_not_recurse(self): @@ -366,7 +366,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/a', name='a')]} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertNotInResponse('file: dummy:/a') self.assertInResponse('OK') @@ -375,7 +375,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/a', name='a')]} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertNotInResponse('directory: dummy') self.assertInResponse('OK') @@ -387,7 +387,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='a', uri='dummy:/a', last_modified=last_modified)] - response = self.sendRequest('lsinfo "/"') + response = self.send_request('lsinfo "/"') self.assertLess(response.index('directory: dummy'), response.index('playlist: a')) @@ -396,27 +396,27 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): 'dummy:/': [Ref.directory(uri='dummy:/a1', name='a'), Ref.directory(uri='dummy:/a2', name='a')]} - self.sendRequest('lsinfo "/dummy"') + self.send_request('lsinfo "/dummy"') self.assertInResponse('directory: dummy/a') self.assertInResponse('directory: dummy/a [2]') def test_update_without_uri(self): - self.sendRequest('update') + self.send_request('update') self.assertInResponse('updating_db: 0') self.assertInResponse('OK') def test_update_with_uri(self): - self.sendRequest('update "file:///dev/urandom"') + self.send_request('update "file:///dev/urandom"') self.assertInResponse('updating_db: 0') self.assertInResponse('OK') def test_rescan_without_uri(self): - self.sendRequest('rescan') + self.send_request('rescan') self.assertInResponse('updating_db: 0') self.assertInResponse('OK') def test_rescan_with_uri(self): - self.sendRequest('rescan "file:///dev/urandom"') + self.send_request('rescan "file:///dev/urandom"') self.assertInResponse('updating_db: 0') self.assertInResponse('OK') @@ -428,7 +428,7 @@ class MusicDatabaseFindTest(protocol.BaseTestCase): artists=[Artist(uri='dummy:artist:b', name='B')], tracks=[Track(uri='dummy:track:c', name='C')]) - self.sendRequest('find "any" "foo"') + self.send_request('find "any" "foo"') self.assertInResponse('file: dummy:artist:b') self.assertInResponse('Title: Artist: B') @@ -448,7 +448,7 @@ class MusicDatabaseFindTest(protocol.BaseTestCase): artists=[Artist(uri='dummy:artist:b', name='B')], tracks=[Track(uri='dummy:track:c', name='C')]) - self.sendRequest('find "artist" "foo"') + self.send_request('find "artist" "foo"') self.assertNotInResponse('file: dummy:artist:b') self.assertNotInResponse('Title: Artist: B') @@ -468,7 +468,7 @@ class MusicDatabaseFindTest(protocol.BaseTestCase): artists=[Artist(uri='dummy:artist:b', name='B')], tracks=[Track(uri='dummy:track:c', name='C')]) - self.sendRequest('find "albumartist" "foo"') + self.send_request('find "albumartist" "foo"') self.assertNotInResponse('file: dummy:artist:b') self.assertNotInResponse('Title: Artist: B') @@ -488,7 +488,7 @@ class MusicDatabaseFindTest(protocol.BaseTestCase): artists=[Artist(uri='dummy:artist:b', name='B')], tracks=[Track(uri='dummy:track:c', name='C')]) - self.sendRequest('find "artist" "foo" "album" "bar"') + self.send_request('find "artist" "foo" "album" "bar"') self.assertNotInResponse('file: dummy:artist:b') self.assertNotInResponse('Title: Artist: B') @@ -503,111 +503,111 @@ class MusicDatabaseFindTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_find_album(self): - self.sendRequest('find "album" "what"') + self.send_request('find "album" "what"') self.assertInResponse('OK') def test_find_album_without_quotes(self): - self.sendRequest('find album "what"') + self.send_request('find album "what"') self.assertInResponse('OK') def test_find_artist(self): - self.sendRequest('find "artist" "what"') + self.send_request('find "artist" "what"') self.assertInResponse('OK') def test_find_artist_without_quotes(self): - self.sendRequest('find artist "what"') + self.send_request('find artist "what"') self.assertInResponse('OK') def test_find_albumartist(self): - self.sendRequest('find "albumartist" "what"') + self.send_request('find "albumartist" "what"') self.assertInResponse('OK') def test_find_albumartist_without_quotes(self): - self.sendRequest('find albumartist "what"') + self.send_request('find albumartist "what"') self.assertInResponse('OK') def test_find_composer(self): - self.sendRequest('find "composer" "what"') + self.send_request('find "composer" "what"') self.assertInResponse('OK') def test_find_composer_without_quotes(self): - self.sendRequest('find composer "what"') + self.send_request('find composer "what"') self.assertInResponse('OK') def test_find_performer(self): - self.sendRequest('find "performer" "what"') + self.send_request('find "performer" "what"') self.assertInResponse('OK') def test_find_performer_without_quotes(self): - self.sendRequest('find performer "what"') + self.send_request('find performer "what"') self.assertInResponse('OK') def test_find_filename(self): - self.sendRequest('find "filename" "afilename"') + self.send_request('find "filename" "afilename"') self.assertInResponse('OK') def test_find_filename_without_quotes(self): - self.sendRequest('find filename "afilename"') + self.send_request('find filename "afilename"') self.assertInResponse('OK') def test_find_file(self): - self.sendRequest('find "file" "afilename"') + self.send_request('find "file" "afilename"') self.assertInResponse('OK') def test_find_file_without_quotes(self): - self.sendRequest('find file "afilename"') + self.send_request('find file "afilename"') self.assertInResponse('OK') def test_find_title(self): - self.sendRequest('find "title" "what"') + self.send_request('find "title" "what"') self.assertInResponse('OK') def test_find_title_without_quotes(self): - self.sendRequest('find title "what"') + self.send_request('find title "what"') self.assertInResponse('OK') def test_find_track_no(self): - self.sendRequest('find "track" "10"') + self.send_request('find "track" "10"') self.assertInResponse('OK') def test_find_track_no_without_quotes(self): - self.sendRequest('find track "10"') + self.send_request('find track "10"') self.assertInResponse('OK') def test_find_track_no_without_filter_value(self): - self.sendRequest('find "track" ""') + self.send_request('find "track" ""') self.assertInResponse('OK') def test_find_genre(self): - self.sendRequest('find "genre" "what"') + self.send_request('find "genre" "what"') self.assertInResponse('OK') def test_find_genre_without_quotes(self): - self.sendRequest('find genre "what"') + self.send_request('find genre "what"') self.assertInResponse('OK') def test_find_date(self): - self.sendRequest('find "date" "2002-01-01"') + self.send_request('find "date" "2002-01-01"') self.assertInResponse('OK') def test_find_date_without_quotes(self): - self.sendRequest('find date "2002-01-01"') + self.send_request('find date "2002-01-01"') self.assertInResponse('OK') def test_find_date_with_capital_d_and_incomplete_date(self): - self.sendRequest('find Date "2005"') + self.send_request('find Date "2005"') self.assertInResponse('OK') def test_find_else_should_fail(self): - self.sendRequest('find "somethingelse" "what"') + self.send_request('find "somethingelse" "what"') self.assertEqualResponse('ACK [2@0] {find} incorrect arguments') def test_find_album_and_artist(self): - self.sendRequest('find album "album_what" artist "artist_what"') + self.send_request('find album "album_what" artist "artist_what"') self.assertInResponse('OK') def test_find_without_filter_value(self): - self.sendRequest('find "album" ""') + self.send_request('find "album" ""') self.assertInResponse('OK') @@ -618,132 +618,132 @@ class MusicDatabaseListTest(protocol.BaseTestCase): Track(uri='dummy:a', name='A', artists=[ Artist(name='A Artist')])]) - self.sendRequest('list "artist" "artist" "foo"') + self.send_request('list "artist" "artist" "foo"') self.assertInResponse('Artist: A Artist') self.assertInResponse('OK') def test_list_foo_returns_ack(self): - self.sendRequest('list "foo"') + self.send_request('list "foo"') self.assertEqualResponse('ACK [2@0] {list} incorrect arguments') # Artist def test_list_artist_with_quotes(self): - self.sendRequest('list "artist"') + self.send_request('list "artist"') self.assertInResponse('OK') def test_list_artist_without_quotes(self): - self.sendRequest('list artist') + self.send_request('list artist') self.assertInResponse('OK') def test_list_artist_without_quotes_and_capitalized(self): - self.sendRequest('list Artist') + self.send_request('list Artist') self.assertInResponse('OK') def test_list_artist_with_query_of_one_token(self): - self.sendRequest('list "artist" "anartist"') + self.send_request('list "artist" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_artist_with_unknown_field_in_query_returns_ack(self): - self.sendRequest('list "artist" "foo" "bar"') + self.send_request('list "artist" "foo" "bar"') self.assertEqualResponse('ACK [2@0] {list} not able to parse args') def test_list_artist_by_artist(self): - self.sendRequest('list "artist" "artist" "anartist"') + self.send_request('list "artist" "artist" "anartist"') self.assertInResponse('OK') def test_list_artist_by_album(self): - self.sendRequest('list "artist" "album" "analbum"') + self.send_request('list "artist" "album" "analbum"') self.assertInResponse('OK') def test_list_artist_by_full_date(self): - self.sendRequest('list "artist" "date" "2001-01-01"') + self.send_request('list "artist" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_artist_by_year(self): - self.sendRequest('list "artist" "date" "2001"') + self.send_request('list "artist" "date" "2001"') self.assertInResponse('OK') def test_list_artist_by_genre(self): - self.sendRequest('list "artist" "genre" "agenre"') + self.send_request('list "artist" "genre" "agenre"') self.assertInResponse('OK') def test_list_artist_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "artist" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_artist_without_filter_value(self): - self.sendRequest('list "artist" "artist" ""') + self.send_request('list "artist" "artist" ""') self.assertInResponse('OK') def test_list_artist_should_not_return_artists_without_names(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(artists=[Artist(name='')])]) - self.sendRequest('list "artist"') + self.send_request('list "artist"') self.assertNotInResponse('Artist: ') self.assertInResponse('OK') # Albumartist def test_list_albumartist_with_quotes(self): - self.sendRequest('list "albumartist"') + self.send_request('list "albumartist"') self.assertInResponse('OK') def test_list_albumartist_without_quotes(self): - self.sendRequest('list albumartist') + self.send_request('list albumartist') self.assertInResponse('OK') def test_list_albumartist_without_quotes_and_capitalized(self): - self.sendRequest('list Albumartist') + self.send_request('list Albumartist') self.assertInResponse('OK') def test_list_albumartist_with_query_of_one_token(self): - self.sendRequest('list "albumartist" "anartist"') + self.send_request('list "albumartist" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_albumartist_with_unknown_field_in_query_returns_ack(self): - self.sendRequest('list "albumartist" "foo" "bar"') + self.send_request('list "albumartist" "foo" "bar"') self.assertEqualResponse('ACK [2@0] {list} not able to parse args') def test_list_albumartist_by_artist(self): - self.sendRequest('list "albumartist" "artist" "anartist"') + self.send_request('list "albumartist" "artist" "anartist"') self.assertInResponse('OK') def test_list_albumartist_by_album(self): - self.sendRequest('list "albumartist" "album" "analbum"') + self.send_request('list "albumartist" "album" "analbum"') self.assertInResponse('OK') def test_list_albumartist_by_full_date(self): - self.sendRequest('list "albumartist" "date" "2001-01-01"') + self.send_request('list "albumartist" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_albumartist_by_year(self): - self.sendRequest('list "albumartist" "date" "2001"') + self.send_request('list "albumartist" "date" "2001"') self.assertInResponse('OK') def test_list_albumartist_by_genre(self): - self.sendRequest('list "albumartist" "genre" "agenre"') + self.send_request('list "albumartist" "genre" "agenre"') self.assertInResponse('OK') def test_list_albumartist_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "albumartist" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_albumartist_without_filter_value(self): - self.sendRequest('list "albumartist" "artist" ""') + self.send_request('list "albumartist" "artist" ""') self.assertInResponse('OK') def test_list_albumartist_should_not_return_artists_without_names(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(album=Album(artists=[Artist(name='')]))]) - self.sendRequest('list "albumartist"') + self.send_request('list "albumartist"') self.assertNotInResponse('Artist: ') self.assertNotInResponse('Albumartist: ') self.assertNotInResponse('Composer: ') @@ -753,60 +753,60 @@ class MusicDatabaseListTest(protocol.BaseTestCase): # Composer def test_list_composer_with_quotes(self): - self.sendRequest('list "composer"') + self.send_request('list "composer"') self.assertInResponse('OK') def test_list_composer_without_quotes(self): - self.sendRequest('list composer') + self.send_request('list composer') self.assertInResponse('OK') def test_list_composer_without_quotes_and_capitalized(self): - self.sendRequest('list Composer') + self.send_request('list Composer') self.assertInResponse('OK') def test_list_composer_with_query_of_one_token(self): - self.sendRequest('list "composer" "anartist"') + self.send_request('list "composer" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_composer_with_unknown_field_in_query_returns_ack(self): - self.sendRequest('list "composer" "foo" "bar"') + self.send_request('list "composer" "foo" "bar"') self.assertEqualResponse('ACK [2@0] {list} not able to parse args') def test_list_composer_by_artist(self): - self.sendRequest('list "composer" "artist" "anartist"') + self.send_request('list "composer" "artist" "anartist"') self.assertInResponse('OK') def test_list_composer_by_album(self): - self.sendRequest('list "composer" "album" "analbum"') + self.send_request('list "composer" "album" "analbum"') self.assertInResponse('OK') def test_list_composer_by_full_date(self): - self.sendRequest('list "composer" "date" "2001-01-01"') + self.send_request('list "composer" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_composer_by_year(self): - self.sendRequest('list "composer" "date" "2001"') + self.send_request('list "composer" "date" "2001"') self.assertInResponse('OK') def test_list_composer_by_genre(self): - self.sendRequest('list "composer" "genre" "agenre"') + self.send_request('list "composer" "genre" "agenre"') self.assertInResponse('OK') def test_list_composer_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "composer" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_composer_without_filter_value(self): - self.sendRequest('list "composer" "artist" ""') + self.send_request('list "composer" "artist" ""') self.assertInResponse('OK') def test_list_composer_should_not_return_artists_without_names(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(composers=[Artist(name='')])]) - self.sendRequest('list "composer"') + self.send_request('list "composer"') self.assertNotInResponse('Artist: ') self.assertNotInResponse('Albumartist: ') self.assertNotInResponse('Composer: ') @@ -816,60 +816,60 @@ class MusicDatabaseListTest(protocol.BaseTestCase): # Performer def test_list_performer_with_quotes(self): - self.sendRequest('list "performer"') + self.send_request('list "performer"') self.assertInResponse('OK') def test_list_performer_without_quotes(self): - self.sendRequest('list performer') + self.send_request('list performer') self.assertInResponse('OK') def test_list_performer_without_quotes_and_capitalized(self): - self.sendRequest('list Albumartist') + self.send_request('list Albumartist') self.assertInResponse('OK') def test_list_performer_with_query_of_one_token(self): - self.sendRequest('list "performer" "anartist"') + self.send_request('list "performer" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_performer_with_unknown_field_in_query_returns_ack(self): - self.sendRequest('list "performer" "foo" "bar"') + self.send_request('list "performer" "foo" "bar"') self.assertEqualResponse('ACK [2@0] {list} not able to parse args') def test_list_performer_by_artist(self): - self.sendRequest('list "performer" "artist" "anartist"') + self.send_request('list "performer" "artist" "anartist"') self.assertInResponse('OK') def test_list_performer_by_album(self): - self.sendRequest('list "performer" "album" "analbum"') + self.send_request('list "performer" "album" "analbum"') self.assertInResponse('OK') def test_list_performer_by_full_date(self): - self.sendRequest('list "performer" "date" "2001-01-01"') + self.send_request('list "performer" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_performer_by_year(self): - self.sendRequest('list "performer" "date" "2001"') + self.send_request('list "performer" "date" "2001"') self.assertInResponse('OK') def test_list_performer_by_genre(self): - self.sendRequest('list "performer" "genre" "agenre"') + self.send_request('list "performer" "genre" "agenre"') self.assertInResponse('OK') def test_list_performer_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "performer" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_performer_without_filter_value(self): - self.sendRequest('list "performer" "artist" ""') + self.send_request('list "performer" "artist" ""') self.assertInResponse('OK') def test_list_performer_should_not_return_artists_without_names(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(performers=[Artist(name='')])]) - self.sendRequest('list "performer"') + self.send_request('list "performer"') self.assertNotInResponse('Artist: ') self.assertNotInResponse('Albumartist: ') self.assertNotInResponse('Composer: ') @@ -879,179 +879,179 @@ class MusicDatabaseListTest(protocol.BaseTestCase): # Album def test_list_album_with_quotes(self): - self.sendRequest('list "album"') + self.send_request('list "album"') self.assertInResponse('OK') def test_list_album_without_quotes(self): - self.sendRequest('list album') + self.send_request('list album') self.assertInResponse('OK') def test_list_album_without_quotes_and_capitalized(self): - self.sendRequest('list Album') + self.send_request('list Album') self.assertInResponse('OK') def test_list_album_with_artist_name(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(album=Album(name='foo'))]) - self.sendRequest('list "album" "anartist"') + self.send_request('list "album" "anartist"') self.assertInResponse('Album: foo') self.assertInResponse('OK') def test_list_album_with_artist_name_without_filter_value(self): - self.sendRequest('list "album" ""') + self.send_request('list "album" ""') self.assertInResponse('OK') def test_list_album_by_artist(self): - self.sendRequest('list "album" "artist" "anartist"') + self.send_request('list "album" "artist" "anartist"') self.assertInResponse('OK') def test_list_album_by_album(self): - self.sendRequest('list "album" "album" "analbum"') + self.send_request('list "album" "album" "analbum"') self.assertInResponse('OK') def test_list_album_by_albumartist(self): - self.sendRequest('list "album" "albumartist" "anartist"') + self.send_request('list "album" "albumartist" "anartist"') self.assertInResponse('OK') def test_list_album_by_composer(self): - self.sendRequest('list "album" "composer" "anartist"') + self.send_request('list "album" "composer" "anartist"') self.assertInResponse('OK') def test_list_album_by_performer(self): - self.sendRequest('list "album" "performer" "anartist"') + self.send_request('list "album" "performer" "anartist"') self.assertInResponse('OK') def test_list_album_by_full_date(self): - self.sendRequest('list "album" "date" "2001-01-01"') + self.send_request('list "album" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_album_by_year(self): - self.sendRequest('list "album" "date" "2001"') + self.send_request('list "album" "date" "2001"') self.assertInResponse('OK') def test_list_album_by_genre(self): - self.sendRequest('list "album" "genre" "agenre"') + self.send_request('list "album" "genre" "agenre"') self.assertInResponse('OK') def test_list_album_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "album" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_album_without_filter_value(self): - self.sendRequest('list "album" "artist" ""') + self.send_request('list "album" "artist" ""') self.assertInResponse('OK') def test_list_album_should_not_return_albums_without_names(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(album=Album(name=''))]) - self.sendRequest('list "album"') + self.send_request('list "album"') self.assertNotInResponse('Album: ') self.assertInResponse('OK') # Date def test_list_date_with_quotes(self): - self.sendRequest('list "date"') + self.send_request('list "date"') self.assertInResponse('OK') def test_list_date_without_quotes(self): - self.sendRequest('list date') + self.send_request('list date') self.assertInResponse('OK') def test_list_date_without_quotes_and_capitalized(self): - self.sendRequest('list Date') + self.send_request('list Date') self.assertInResponse('OK') def test_list_date_with_query_of_one_token(self): - self.sendRequest('list "date" "anartist"') + self.send_request('list "date" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_date_by_artist(self): - self.sendRequest('list "date" "artist" "anartist"') + self.send_request('list "date" "artist" "anartist"') self.assertInResponse('OK') def test_list_date_by_album(self): - self.sendRequest('list "date" "album" "analbum"') + self.send_request('list "date" "album" "analbum"') self.assertInResponse('OK') def test_list_date_by_full_date(self): - self.sendRequest('list "date" "date" "2001-01-01"') + self.send_request('list "date" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_date_by_year(self): - self.sendRequest('list "date" "date" "2001"') + self.send_request('list "date" "date" "2001"') self.assertInResponse('OK') def test_list_date_by_genre(self): - self.sendRequest('list "date" "genre" "agenre"') + self.send_request('list "date" "genre" "agenre"') self.assertInResponse('OK') def test_list_date_by_artist_and_album(self): - self.sendRequest('list "date" "artist" "anartist" "album" "analbum"') + self.send_request('list "date" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_date_without_filter_value(self): - self.sendRequest('list "date" "artist" ""') + self.send_request('list "date" "artist" ""') self.assertInResponse('OK') def test_list_date_should_not_return_blank_dates(self): self.backend.library.dummy_find_exact_result = SearchResult( tracks=[Track(date='')]) - self.sendRequest('list "date"') + self.send_request('list "date"') self.assertNotInResponse('Date: ') self.assertInResponse('OK') # Genre def test_list_genre_with_quotes(self): - self.sendRequest('list "genre"') + self.send_request('list "genre"') self.assertInResponse('OK') def test_list_genre_without_quotes(self): - self.sendRequest('list genre') + self.send_request('list genre') self.assertInResponse('OK') def test_list_genre_without_quotes_and_capitalized(self): - self.sendRequest('list Genre') + self.send_request('list Genre') self.assertInResponse('OK') def test_list_genre_with_query_of_one_token(self): - self.sendRequest('list "genre" "anartist"') + self.send_request('list "genre" "anartist"') self.assertEqualResponse( 'ACK [2@0] {list} should be "Album" for 3 arguments') def test_list_genre_by_artist(self): - self.sendRequest('list "genre" "artist" "anartist"') + self.send_request('list "genre" "artist" "anartist"') self.assertInResponse('OK') def test_list_genre_by_album(self): - self.sendRequest('list "genre" "album" "analbum"') + self.send_request('list "genre" "album" "analbum"') self.assertInResponse('OK') def test_list_genre_by_full_date(self): - self.sendRequest('list "genre" "date" "2001-01-01"') + self.send_request('list "genre" "date" "2001-01-01"') self.assertInResponse('OK') def test_list_genre_by_year(self): - self.sendRequest('list "genre" "date" "2001"') + self.send_request('list "genre" "date" "2001"') self.assertInResponse('OK') def test_list_genre_by_genre(self): - self.sendRequest('list "genre" "genre" "agenre"') + self.send_request('list "genre" "genre" "agenre"') self.assertInResponse('OK') def test_list_genre_by_artist_and_album(self): - self.sendRequest( + self.send_request( 'list "genre" "artist" "anartist" "album" "analbum"') self.assertInResponse('OK') def test_list_genre_without_filter_value(self): - self.sendRequest('list "genre" "artist" ""') + self.send_request('list "genre" "artist" ""') self.assertInResponse('OK') @@ -1062,7 +1062,7 @@ class MusicDatabaseSearchTest(protocol.BaseTestCase): artists=[Artist(uri='dummy:artist:b', name='B')], tracks=[Track(uri='dummy:track:c', name='C')]) - self.sendRequest('search "any" "foo"') + self.send_request('search "any" "foo"') self.assertInResponse('file: dummy:album:a') self.assertInResponse('Title: Album: A') @@ -1074,165 +1074,165 @@ class MusicDatabaseSearchTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_search_album(self): - self.sendRequest('search "album" "analbum"') + self.send_request('search "album" "analbum"') self.assertInResponse('OK') def test_search_album_without_quotes(self): - self.sendRequest('search album "analbum"') + self.send_request('search album "analbum"') self.assertInResponse('OK') def test_search_album_without_filter_value(self): - self.sendRequest('search "album" ""') + self.send_request('search "album" ""') self.assertInResponse('OK') def test_search_artist(self): - self.sendRequest('search "artist" "anartist"') + self.send_request('search "artist" "anartist"') self.assertInResponse('OK') def test_search_artist_without_quotes(self): - self.sendRequest('search artist "anartist"') + self.send_request('search artist "anartist"') self.assertInResponse('OK') def test_search_artist_without_filter_value(self): - self.sendRequest('search "artist" ""') + self.send_request('search "artist" ""') self.assertInResponse('OK') def test_search_albumartist(self): - self.sendRequest('search "albumartist" "analbumartist"') + self.send_request('search "albumartist" "analbumartist"') self.assertInResponse('OK') def test_search_albumartist_without_quotes(self): - self.sendRequest('search albumartist "analbumartist"') + self.send_request('search albumartist "analbumartist"') self.assertInResponse('OK') def test_search_albumartist_without_filter_value(self): - self.sendRequest('search "albumartist" ""') + self.send_request('search "albumartist" ""') self.assertInResponse('OK') def test_search_composer(self): - self.sendRequest('search "composer" "acomposer"') + self.send_request('search "composer" "acomposer"') self.assertInResponse('OK') def test_search_composer_without_quotes(self): - self.sendRequest('search composer "acomposer"') + self.send_request('search composer "acomposer"') self.assertInResponse('OK') def test_search_composer_without_filter_value(self): - self.sendRequest('search "composer" ""') + self.send_request('search "composer" ""') self.assertInResponse('OK') def test_search_performer(self): - self.sendRequest('search "performer" "aperformer"') + self.send_request('search "performer" "aperformer"') self.assertInResponse('OK') def test_search_performer_without_quotes(self): - self.sendRequest('search performer "aperformer"') + self.send_request('search performer "aperformer"') self.assertInResponse('OK') def test_search_performer_without_filter_value(self): - self.sendRequest('search "performer" ""') + self.send_request('search "performer" ""') self.assertInResponse('OK') def test_search_filename(self): - self.sendRequest('search "filename" "afilename"') + self.send_request('search "filename" "afilename"') self.assertInResponse('OK') def test_search_filename_without_quotes(self): - self.sendRequest('search filename "afilename"') + self.send_request('search filename "afilename"') self.assertInResponse('OK') def test_search_filename_without_filter_value(self): - self.sendRequest('search "filename" ""') + self.send_request('search "filename" ""') self.assertInResponse('OK') def test_search_file(self): - self.sendRequest('search "file" "afilename"') + self.send_request('search "file" "afilename"') self.assertInResponse('OK') def test_search_file_without_quotes(self): - self.sendRequest('search file "afilename"') + self.send_request('search file "afilename"') self.assertInResponse('OK') def test_search_file_without_filter_value(self): - self.sendRequest('search "file" ""') + self.send_request('search "file" ""') self.assertInResponse('OK') def test_search_title(self): - self.sendRequest('search "title" "atitle"') + self.send_request('search "title" "atitle"') self.assertInResponse('OK') def test_search_title_without_quotes(self): - self.sendRequest('search title "atitle"') + self.send_request('search title "atitle"') self.assertInResponse('OK') def test_search_title_without_filter_value(self): - self.sendRequest('search "title" ""') + self.send_request('search "title" ""') self.assertInResponse('OK') def test_search_any(self): - self.sendRequest('search "any" "anything"') + self.send_request('search "any" "anything"') self.assertInResponse('OK') def test_search_any_without_quotes(self): - self.sendRequest('search any "anything"') + self.send_request('search any "anything"') self.assertInResponse('OK') def test_search_any_without_filter_value(self): - self.sendRequest('search "any" ""') + self.send_request('search "any" ""') self.assertInResponse('OK') def test_search_track_no(self): - self.sendRequest('search "track" "10"') + self.send_request('search "track" "10"') self.assertInResponse('OK') def test_search_track_no_without_quotes(self): - self.sendRequest('search track "10"') + self.send_request('search track "10"') self.assertInResponse('OK') def test_search_track_no_without_filter_value(self): - self.sendRequest('search "track" ""') + self.send_request('search "track" ""') self.assertInResponse('OK') def test_search_genre(self): - self.sendRequest('search "genre" "agenre"') + self.send_request('search "genre" "agenre"') self.assertInResponse('OK') def test_search_genre_without_quotes(self): - self.sendRequest('search genre "agenre"') + self.send_request('search genre "agenre"') self.assertInResponse('OK') def test_search_genre_without_filter_value(self): - self.sendRequest('search "genre" ""') + self.send_request('search "genre" ""') self.assertInResponse('OK') def test_search_date(self): - self.sendRequest('search "date" "2002-01-01"') + self.send_request('search "date" "2002-01-01"') self.assertInResponse('OK') def test_search_date_without_quotes(self): - self.sendRequest('search date "2002-01-01"') + self.send_request('search date "2002-01-01"') self.assertInResponse('OK') def test_search_date_with_capital_d_and_incomplete_date(self): - self.sendRequest('search Date "2005"') + self.send_request('search Date "2005"') self.assertInResponse('OK') def test_search_date_without_filter_value(self): - self.sendRequest('search "date" ""') + self.send_request('search "date" ""') self.assertInResponse('OK') def test_search_comment(self): - self.sendRequest('search "comment" "acomment"') + self.send_request('search "comment" "acomment"') self.assertInResponse('OK') def test_search_comment_without_quotes(self): - self.sendRequest('search comment "acomment"') + self.send_request('search comment "acomment"') self.assertInResponse('OK') def test_search_comment_without_filter_value(self): - self.sendRequest('search "comment" ""') + self.send_request('search "comment" ""') self.assertInResponse('OK') def test_search_else_should_fail(self): - self.sendRequest('search "sometype" "something"') + self.send_request('search "sometype" "something"') self.assertEqualResponse('ACK [2@0] {search} incorrect arguments') diff --git a/tests/mpd/protocol/test_playback.py b/tests/mpd/protocol/test_playback.py index d13cf65f..1cd62bba 100644 --- a/tests/mpd/protocol/test_playback.py +++ b/tests/mpd/protocol/test_playback.py @@ -15,138 +15,138 @@ STOPPED = PlaybackState.STOPPED class PlaybackOptionsHandlerTest(protocol.BaseTestCase): def test_consume_off(self): - self.sendRequest('consume "0"') + self.send_request('consume "0"') self.assertFalse(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_off_without_quotes(self): - self.sendRequest('consume 0') + self.send_request('consume 0') self.assertFalse(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_on(self): - self.sendRequest('consume "1"') + self.send_request('consume "1"') self.assertTrue(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_consume_on_without_quotes(self): - self.sendRequest('consume 1') + self.send_request('consume 1') self.assertTrue(self.core.tracklist.consume.get()) self.assertInResponse('OK') def test_crossfade(self): - self.sendRequest('crossfade "10"') + self.send_request('crossfade "10"') self.assertInResponse('ACK [0@0] {crossfade} Not implemented') def test_random_off(self): - self.sendRequest('random "0"') + self.send_request('random "0"') self.assertFalse(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_off_without_quotes(self): - self.sendRequest('random 0') + self.send_request('random 0') self.assertFalse(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_on(self): - self.sendRequest('random "1"') + self.send_request('random "1"') self.assertTrue(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_random_on_without_quotes(self): - self.sendRequest('random 1') + self.send_request('random 1') self.assertTrue(self.core.tracklist.random.get()) self.assertInResponse('OK') def test_repeat_off(self): - self.sendRequest('repeat "0"') + self.send_request('repeat "0"') self.assertFalse(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_off_without_quotes(self): - self.sendRequest('repeat 0') + self.send_request('repeat 0') self.assertFalse(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_on(self): - self.sendRequest('repeat "1"') + self.send_request('repeat "1"') self.assertTrue(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_repeat_on_without_quotes(self): - self.sendRequest('repeat 1') + self.send_request('repeat 1') self.assertTrue(self.core.tracklist.repeat.get()) self.assertInResponse('OK') def test_setvol_below_min(self): - self.sendRequest('setvol "-10"') + self.send_request('setvol "-10"') self.assertEqual(0, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_min(self): - self.sendRequest('setvol "0"') + self.send_request('setvol "0"') self.assertEqual(0, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_middle(self): - self.sendRequest('setvol "50"') + self.send_request('setvol "50"') self.assertEqual(50, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_max(self): - self.sendRequest('setvol "100"') + self.send_request('setvol "100"') self.assertEqual(100, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_above_max(self): - self.sendRequest('setvol "110"') + self.send_request('setvol "110"') self.assertEqual(100, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_plus_is_ignored(self): - self.sendRequest('setvol "+10"') + self.send_request('setvol "+10"') self.assertEqual(10, self.core.playback.volume.get()) self.assertInResponse('OK') def test_setvol_without_quotes(self): - self.sendRequest('setvol 50') + self.send_request('setvol 50') self.assertEqual(50, self.core.playback.volume.get()) self.assertInResponse('OK') def test_single_off(self): - self.sendRequest('single "0"') + self.send_request('single "0"') self.assertFalse(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_off_without_quotes(self): - self.sendRequest('single 0') + self.send_request('single 0') self.assertFalse(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_on(self): - self.sendRequest('single "1"') + self.send_request('single "1"') self.assertTrue(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_single_on_without_quotes(self): - self.sendRequest('single 1') + self.send_request('single 1') self.assertTrue(self.core.tracklist.single.get()) self.assertInResponse('OK') def test_replay_gain_mode_off(self): - self.sendRequest('replay_gain_mode "off"') + self.send_request('replay_gain_mode "off"') self.assertInResponse('ACK [0@0] {replay_gain_mode} Not implemented') def test_replay_gain_mode_track(self): - self.sendRequest('replay_gain_mode "track"') + self.send_request('replay_gain_mode "track"') self.assertInResponse('ACK [0@0] {replay_gain_mode} Not implemented') def test_replay_gain_mode_album(self): - self.sendRequest('replay_gain_mode "album"') + self.send_request('replay_gain_mode "album"') self.assertInResponse('ACK [0@0] {replay_gain_mode} Not implemented') def test_replay_gain_status_default(self): - self.sendRequest('replay_gain_status') + self.send_request('replay_gain_status') self.assertInResponse('OK') self.assertInResponse('off') @@ -165,66 +165,66 @@ class PlaybackOptionsHandlerTest(protocol.BaseTestCase): class PlaybackControlHandlerTest(protocol.BaseTestCase): def test_next(self): - self.sendRequest('next') + self.send_request('next') self.assertInResponse('OK') def test_pause_off(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play "0"') - self.sendRequest('pause "1"') - self.sendRequest('pause "0"') + self.send_request('play "0"') + self.send_request('pause "1"') + self.send_request('pause "0"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_pause_on(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play "0"') - self.sendRequest('pause "1"') + self.send_request('play "0"') + self.send_request('pause "1"') self.assertEqual(PAUSED, self.core.playback.state.get()) self.assertInResponse('OK') def test_pause_toggle(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play "0"') + self.send_request('play "0"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') - self.sendRequest('pause') + self.send_request('pause') self.assertEqual(PAUSED, self.core.playback.state.get()) self.assertInResponse('OK') - self.sendRequest('pause') + self.send_request('pause') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_play_without_pos(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play') + self.send_request('play') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_play_with_pos(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play "0"') + self.send_request('play "0"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_play_with_pos_without_quotes(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('play 0') + self.send_request('play 0') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_play_with_pos_out_of_bounds(self): self.core.tracklist.add([]) - self.sendRequest('play "0"') + self.send_request('play "0"') self.assertEqual(STOPPED, self.core.playback.state.get()) self.assertInResponse('ACK [2@0] {play} Bad song index') @@ -232,7 +232,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.assertEqual(self.core.playback.current_track.get(), None) self.core.tracklist.add([Track(uri='dummy:a'), Track(uri='dummy:b')]) - self.sendRequest('play "-1"') + self.send_request('play "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertEqual( 'dummy:a', self.core.playback.current_track.get().uri) @@ -246,7 +246,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.stop() self.assertNotEqual(self.core.playback.current_track.get(), None) - self.sendRequest('play "-1"') + self.send_request('play "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertEqual( 'dummy:b', self.core.playback.current_track.get().uri) @@ -255,7 +255,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): def test_play_minus_one_on_empty_playlist_does_not_ack(self): self.core.tracklist.clear() - self.sendRequest('play "-1"') + self.send_request('play "-1"') self.assertEqual(STOPPED, self.core.playback.state.get()) self.assertEqual(None, self.core.playback.current_track.get()) self.assertInResponse('OK') @@ -267,7 +267,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.time_position.get(), 30000) self.assertEquals(PLAYING, self.core.playback.state.get()) - self.sendRequest('play "-1"') + self.send_request('play "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertGreaterEqual( self.core.playback.time_position.get(), 30000) @@ -282,7 +282,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.pause() self.assertEquals(PAUSED, self.core.playback.state.get()) - self.sendRequest('play "-1"') + self.send_request('play "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertGreaterEqual( self.core.playback.time_position.get(), 30000) @@ -291,14 +291,14 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): def test_playid(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('playid "0"') + self.send_request('playid "0"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') def test_playid_without_quotes(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('playid 0') + self.send_request('playid 0') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertInResponse('OK') @@ -306,7 +306,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.assertEqual(self.core.playback.current_track.get(), None) self.core.tracklist.add([Track(uri='dummy:a'), Track(uri='dummy:b')]) - self.sendRequest('playid "-1"') + self.send_request('playid "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertEqual( 'dummy:a', self.core.playback.current_track.get().uri) @@ -320,7 +320,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.stop() self.assertNotEqual(None, self.core.playback.current_track.get()) - self.sendRequest('playid "-1"') + self.send_request('playid "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertEqual( 'dummy:b', self.core.playback.current_track.get().uri) @@ -329,7 +329,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): def test_playid_minus_one_on_empty_playlist_does_not_ack(self): self.core.tracklist.clear() - self.sendRequest('playid "-1"') + self.send_request('playid "-1"') self.assertEqual(STOPPED, self.core.playback.state.get()) self.assertEqual(None, self.core.playback.current_track.get()) self.assertInResponse('OK') @@ -341,7 +341,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.time_position.get(), 30000) self.assertEquals(PLAYING, self.core.playback.state.get()) - self.sendRequest('playid "-1"') + self.send_request('playid "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertGreaterEqual( self.core.playback.time_position.get(), 30000) @@ -356,7 +356,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.pause() self.assertEquals(PAUSED, self.core.playback.state.get()) - self.sendRequest('playid "-1"') + self.send_request('playid "-1"') self.assertEqual(PLAYING, self.core.playback.state.get()) self.assertGreaterEqual( self.core.playback.time_position.get(), 30000) @@ -365,11 +365,11 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): def test_playid_which_does_not_exist(self): self.core.tracklist.add([Track(uri='dummy:a')]) - self.sendRequest('playid "12345"') + self.send_request('playid "12345"') self.assertInResponse('ACK [50@0] {playid} No such song') def test_previous(self): - self.sendRequest('previous') + self.send_request('previous') self.assertInResponse('OK') def test_seek_in_current_track(self): @@ -377,7 +377,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([seek_track]) self.core.playback.play() - self.sendRequest('seek "0" "30"') + self.send_request('seek "0" "30"') self.assertEqual(self.core.playback.current_track.get(), seek_track) self.assertGreaterEqual(self.core.playback.time_position, 30000) @@ -390,7 +390,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.play() self.assertNotEqual(self.core.playback.current_track.get(), seek_track) - self.sendRequest('seek "1" "30"') + self.send_request('seek "1" "30"') self.assertEqual(self.core.playback.current_track.get(), seek_track) self.assertInResponse('OK') @@ -399,7 +399,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([Track(uri='dummy:a', length=40000)]) self.core.playback.play() - self.sendRequest('seek 0 30') + self.send_request('seek 0 30') self.assertGreaterEqual( self.core.playback.time_position.get(), 30000) self.assertInResponse('OK') @@ -409,7 +409,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([seek_track]) self.core.playback.play() - self.sendRequest('seekid "0" "30"') + self.send_request('seekid "0" "30"') self.assertEqual(self.core.playback.current_track.get(), seek_track) self.assertGreaterEqual( @@ -422,7 +422,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): [Track(uri='dummy:a', length=40000), seek_track]) self.core.playback.play() - self.sendRequest('seekid "1" "30"') + self.send_request('seekid "1" "30"') self.assertEqual(1, self.core.playback.current_tl_track.get().tlid) self.assertEqual(seek_track, self.core.playback.current_track.get()) @@ -432,7 +432,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.tracklist.add([Track(uri='dummy:a', length=40000)]) self.core.playback.play() - self.sendRequest('seekcur "30"') + self.send_request('seekcur "30"') self.assertGreaterEqual(self.core.playback.time_position.get(), 30000) self.assertInResponse('OK') @@ -443,7 +443,7 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.seek(10000) self.assertGreaterEqual(self.core.playback.time_position.get(), 10000) - self.sendRequest('seekcur "+20"') + self.send_request('seekcur "+20"') self.assertGreaterEqual(self.core.playback.time_position.get(), 30000) self.assertInResponse('OK') @@ -454,12 +454,12 @@ class PlaybackControlHandlerTest(protocol.BaseTestCase): self.core.playback.seek(30000) self.assertGreaterEqual(self.core.playback.time_position.get(), 30000) - self.sendRequest('seekcur "-20"') + self.send_request('seekcur "-20"') self.assertLessEqual(self.core.playback.time_position.get(), 15000) self.assertInResponse('OK') def test_stop(self): - self.sendRequest('stop') + self.send_request('stop') self.assertEqual(STOPPED, self.core.playback.state.get()) self.assertInResponse('OK') diff --git a/tests/mpd/protocol/test_reflection.py b/tests/mpd/protocol/test_reflection.py index e721d799..5c44c464 100644 --- a/tests/mpd/protocol/test_reflection.py +++ b/tests/mpd/protocol/test_reflection.py @@ -5,12 +5,12 @@ from tests.mpd import protocol class ReflectionHandlerTest(protocol.BaseTestCase): def test_config_is_not_allowed_across_the_network(self): - self.sendRequest('config') + self.send_request('config') self.assertEqualResponse( 'ACK [4@0] {config} you don\'t have permission for "config"') def test_commands_returns_list_of_all_commands(self): - self.sendRequest('commands') + self.send_request('commands') # Check if some random commands are included self.assertInResponse('command: commands') self.assertInResponse('command: play') @@ -28,22 +28,22 @@ class ReflectionHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_decoders(self): - self.sendRequest('decoders') + self.send_request('decoders') self.assertInResponse('OK') def test_notcommands_returns_only_config_and_kill_and_ok(self): - response = self.sendRequest('notcommands') + response = self.send_request('notcommands') self.assertEqual(3, len(response)) self.assertInResponse('command: config') self.assertInResponse('command: kill') self.assertInResponse('OK') def test_tagtypes(self): - self.sendRequest('tagtypes') + self.send_request('tagtypes') self.assertInResponse('OK') def test_urlhandlers(self): - self.sendRequest('urlhandlers') + self.send_request('urlhandlers') self.assertInResponse('OK') self.assertInResponse('handler: dummy') @@ -55,7 +55,7 @@ class ReflectionWhenNotAuthedTest(protocol.BaseTestCase): return config def test_commands_show_less_if_auth_required_and_not_authed(self): - self.sendRequest('commands') + self.send_request('commands') # Not requiring auth self.assertInResponse('command: close') self.assertInResponse('command: commands') @@ -67,7 +67,7 @@ class ReflectionWhenNotAuthedTest(protocol.BaseTestCase): self.assertNotInResponse('command: status') def test_notcommands_returns_more_if_auth_required_and_not_authed(self): - self.sendRequest('notcommands') + self.send_request('notcommands') # Not requiring auth self.assertNotInResponse('command: close') self.assertNotInResponse('command: commands') diff --git a/tests/mpd/protocol/test_regression.py b/tests/mpd/protocol/test_regression.py index b0e9d450..09ec8a46 100644 --- a/tests/mpd/protocol/test_regression.py +++ b/tests/mpd/protocol/test_regression.py @@ -28,21 +28,21 @@ class IssueGH17RegressionTest(protocol.BaseTestCase): ]) random.seed(1) # Playlist order: abcfde - self.sendRequest('play') + self.send_request('play') self.assertEquals( 'dummy:a', self.core.playback.current_track.get().uri) - self.sendRequest('random "1"') - self.sendRequest('next') + self.send_request('random "1"') + self.send_request('next') self.assertEquals( 'dummy:b', self.core.playback.current_track.get().uri) - self.sendRequest('next') + self.send_request('next') # Should now be at track 'c', but playback fails and it skips ahead self.assertEquals( 'dummy:f', self.core.playback.current_track.get().uri) - self.sendRequest('next') + self.send_request('next') self.assertEquals( 'dummy:d', self.core.playback.current_track.get().uri) - self.sendRequest('next') + self.send_request('next') self.assertEquals( 'dummy:e', self.core.playback.current_track.get().uri) @@ -64,17 +64,17 @@ class IssueGH18RegressionTest(protocol.BaseTestCase): Track(uri='dummy:d'), Track(uri='dummy:e'), Track(uri='dummy:f')]) random.seed(1) - self.sendRequest('play') - self.sendRequest('random "1"') - self.sendRequest('next') - self.sendRequest('random "0"') - self.sendRequest('next') + self.send_request('play') + self.send_request('random "1"') + self.send_request('next') + self.send_request('random "0"') + self.send_request('next') - self.sendRequest('next') + self.send_request('next') tl_track_1 = self.core.playback.current_tl_track.get() - self.sendRequest('next') + self.send_request('next') tl_track_2 = self.core.playback.current_tl_track.get() - self.sendRequest('next') + self.send_request('next') tl_track_3 = self.core.playback.current_tl_track.get() self.assertNotEqual(tl_track_1, tl_track_2) @@ -100,15 +100,15 @@ class IssueGH22RegressionTest(protocol.BaseTestCase): Track(uri='dummy:d'), Track(uri='dummy:e'), Track(uri='dummy:f')]) random.seed(1) - self.sendRequest('play') - self.sendRequest('random "1"') - self.sendRequest('deleteid "1"') - self.sendRequest('deleteid "2"') - self.sendRequest('deleteid "3"') - self.sendRequest('deleteid "4"') - self.sendRequest('deleteid "5"') - self.sendRequest('deleteid "6"') - self.sendRequest('status') + self.send_request('play') + self.send_request('random "1"') + self.send_request('deleteid "1"') + self.send_request('deleteid "2"') + self.send_request('deleteid "3"') + self.send_request('deleteid "4"') + self.send_request('deleteid "5"') + self.send_request('deleteid "6"') + self.send_request('status') class IssueGH69RegressionTest(protocol.BaseTestCase): @@ -128,10 +128,10 @@ class IssueGH69RegressionTest(protocol.BaseTestCase): Track(uri='dummy:a'), Track(uri='dummy:b'), Track(uri='dummy:c'), Track(uri='dummy:d'), Track(uri='dummy:e'), Track(uri='dummy:f')]) - self.sendRequest('play') - self.sendRequest('stop') - self.sendRequest('clear') - self.sendRequest('load "foo"') + self.send_request('play') + self.send_request('stop') + self.send_request('clear') + self.send_request('load "foo"') self.assertNotInResponse('song: None') @@ -151,11 +151,11 @@ class IssueGH113RegressionTest(protocol.BaseTestCase): self.core.playlists.create( u'all lart spotify:track:\w\{22\} pastes') - self.sendRequest('lsinfo "/"') + self.send_request('lsinfo "/"') self.assertInResponse( u'playlist: all lart spotify:track:\w\{22\} pastes') - self.sendRequest( + self.send_request( r'listplaylistinfo "all lart spotify:track:\\w\\{22\\} pastes"') self.assertInResponse('OK') @@ -170,7 +170,7 @@ class IssueGH137RegressionTest(protocol.BaseTestCase): """ def test(self): - self.sendRequest( + self.send_request( u'list Date Artist "Anita Ward" ' u'Album "This Is Remixed Hits - Mashups & Rare 12" Mixes"') diff --git a/tests/mpd/protocol/test_status.py b/tests/mpd/protocol/test_status.py index 87e63a1a..09df3526 100644 --- a/tests/mpd/protocol/test_status.py +++ b/tests/mpd/protocol/test_status.py @@ -7,14 +7,14 @@ from tests.mpd import protocol class StatusHandlerTest(protocol.BaseTestCase): def test_clearerror(self): - self.sendRequest('clearerror') + self.send_request('clearerror') self.assertEqualResponse('ACK [0@0] {clearerror} Not implemented') def test_currentsong(self): track = Track() self.core.tracklist.add([track]) self.core.playback.play() - self.sendRequest('currentsong') + self.send_request('currentsong') self.assertInResponse('file: ') self.assertInResponse('Time: 0') self.assertInResponse('Artist: ') @@ -27,13 +27,13 @@ class StatusHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_currentsong_without_song(self): - self.sendRequest('currentsong') + self.send_request('currentsong') self.assertInResponse('OK') def test_stats_command(self): - self.sendRequest('stats') + self.send_request('stats') self.assertInResponse('OK') def test_status_command(self): - self.sendRequest('status') + self.send_request('status') self.assertInResponse('OK') diff --git a/tests/mpd/protocol/test_stickers.py b/tests/mpd/protocol/test_stickers.py index 9eae1ac6..0844c461 100644 --- a/tests/mpd/protocol/test_stickers.py +++ b/tests/mpd/protocol/test_stickers.py @@ -5,31 +5,31 @@ from tests.mpd import protocol class StickersHandlerTest(protocol.BaseTestCase): def test_sticker_get(self): - self.sendRequest( + self.send_request( 'sticker get "song" "file:///dev/urandom" "a_name"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') def test_sticker_set(self): - self.sendRequest( + self.send_request( 'sticker set "song" "file:///dev/urandom" "a_name" "a_value"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') def test_sticker_delete_with_name(self): - self.sendRequest( + self.send_request( 'sticker delete "song" "file:///dev/urandom" "a_name"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') def test_sticker_delete_without_name(self): - self.sendRequest( + self.send_request( 'sticker delete "song" "file:///dev/urandom"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') def test_sticker_list(self): - self.sendRequest( + self.send_request( 'sticker list "song" "file:///dev/urandom"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') def test_sticker_find(self): - self.sendRequest( + self.send_request( 'sticker find "song" "file:///dev/urandom" "a_name"') self.assertEqualResponse('ACK [0@0] {sticker} Not implemented') diff --git a/tests/mpd/protocol/test_stored_playlists.py b/tests/mpd/protocol/test_stored_playlists.py index bc66387a..a9190aa1 100644 --- a/tests/mpd/protocol/test_stored_playlists.py +++ b/tests/mpd/protocol/test_stored_playlists.py @@ -11,7 +11,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist( name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])] - self.sendRequest('listplaylist "name"') + self.send_request('listplaylist "name"') self.assertInResponse('file: dummy:a') self.assertInResponse('OK') @@ -20,12 +20,12 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist( name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])] - self.sendRequest('listplaylist name') + self.send_request('listplaylist name') self.assertInResponse('file: dummy:a') self.assertInResponse('OK') def test_listplaylist_fails_if_no_playlist_is_found(self): - self.sendRequest('listplaylist "name"') + self.send_request('listplaylist "name"') self.assertEqualResponse('ACK [50@0] {listplaylist} No such playlist') def test_listplaylist_duplicate(self): @@ -33,7 +33,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): playlist2 = Playlist(name='a', uri='dummy:a2', tracks=[Track(uri='c')]) self.backend.playlists.playlists = [playlist1, playlist2] - self.sendRequest('listplaylist "a [2]"') + self.send_request('listplaylist "a [2]"') self.assertInResponse('file: c') self.assertInResponse('OK') @@ -42,7 +42,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist( name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])] - self.sendRequest('listplaylistinfo "name"') + self.send_request('listplaylistinfo "name"') self.assertInResponse('file: dummy:a') self.assertInResponse('Track: 0') self.assertNotInResponse('Pos: 0') @@ -53,14 +53,14 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist( name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])] - self.sendRequest('listplaylistinfo name') + self.send_request('listplaylistinfo name') self.assertInResponse('file: dummy:a') self.assertInResponse('Track: 0') self.assertNotInResponse('Pos: 0') self.assertInResponse('OK') def test_listplaylistinfo_fails_if_no_playlist_is_found(self): - self.sendRequest('listplaylistinfo "name"') + self.send_request('listplaylistinfo "name"') self.assertEqualResponse( 'ACK [50@0] {listplaylistinfo} No such playlist') @@ -69,7 +69,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): playlist2 = Playlist(name='a', uri='dummy:a2', tracks=[Track(uri='c')]) self.backend.playlists.playlists = [playlist1, playlist2] - self.sendRequest('listplaylistinfo "a [2]"') + self.send_request('listplaylistinfo "a [2]"') self.assertInResponse('file: c') self.assertInResponse('Track: 0') self.assertNotInResponse('Pos: 0') @@ -80,7 +80,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='a', uri='dummy:a', last_modified=last_modified)] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertInResponse('playlist: a') # Date without milliseconds and with time zone information self.assertInResponse('Last-Modified: 2014-01-28T21:01:13Z') @@ -91,7 +91,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): playlist2 = Playlist(name='a', uri='dummy:a2') self.backend.playlists.playlists = [playlist1, playlist2] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertInResponse('playlist: a') self.assertInResponse('playlist: a [2]') self.assertInResponse('OK') @@ -101,14 +101,14 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): self.backend.playlists.playlists = [ Playlist(name='', uri='dummy:', last_modified=last_modified)] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertNotInResponse('playlist: ') self.assertInResponse('OK') def test_listplaylists_replaces_newline_with_space(self): self.backend.playlists.playlists = [ Playlist(name='a\n', uri='dummy:')] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertInResponse('playlist: a ') self.assertNotInResponse('playlist: a\n') self.assertInResponse('OK') @@ -116,7 +116,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): def test_listplaylists_replaces_carriage_return_with_space(self): self.backend.playlists.playlists = [ Playlist(name='a\r', uri='dummy:')] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertInResponse('playlist: a ') self.assertNotInResponse('playlist: a\r') self.assertInResponse('OK') @@ -124,7 +124,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): def test_listplaylists_replaces_forward_slash_with_pipe(self): self.backend.playlists.playlists = [ Playlist(name='a/b', uri='dummy:')] - self.sendRequest('listplaylists') + self.send_request('listplaylists') self.assertInResponse('playlist: a|b') self.assertNotInResponse('playlist: a/b') self.assertInResponse('OK') @@ -136,7 +136,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist(name='A-list', uri='dummy:A-list', tracks=[ Track(uri='c'), Track(uri='d'), Track(uri='e')])] - self.sendRequest('load "A-list"') + self.send_request('load "A-list"') tracks = self.core.tracklist.tracks.get() self.assertEqual(5, len(tracks)) @@ -154,7 +154,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist(name='A-list', uri='dummy:A-list', tracks=[ Track(uri='c'), Track(uri='d'), Track(uri='e')])] - self.sendRequest('load "A-list" "1:2"') + self.send_request('load "A-list" "1:2"') tracks = self.core.tracklist.tracks.get() self.assertEqual(3, len(tracks)) @@ -170,7 +170,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): Playlist(name='A-list', uri='dummy:A-list', tracks=[ Track(uri='c'), Track(uri='d'), Track(uri='e')])] - self.sendRequest('load "A-list" "1:"') + self.send_request('load "A-list" "1:"') tracks = self.core.tracklist.tracks.get() self.assertEqual(4, len(tracks)) @@ -181,34 +181,34 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): self.assertInResponse('OK') def test_load_unknown_playlist_acks(self): - self.sendRequest('load "unknown playlist"') + self.send_request('load "unknown playlist"') self.assertEqual(0, len(self.core.tracklist.tracks.get())) self.assertEqualResponse('ACK [50@0] {load} No such playlist') def test_playlistadd(self): - self.sendRequest('playlistadd "name" "dummy:a"') + self.send_request('playlistadd "name" "dummy:a"') self.assertEqualResponse('ACK [0@0] {playlistadd} Not implemented') def test_playlistclear(self): - self.sendRequest('playlistclear "name"') + self.send_request('playlistclear "name"') self.assertEqualResponse('ACK [0@0] {playlistclear} Not implemented') def test_playlistdelete(self): - self.sendRequest('playlistdelete "name" "5"') + self.send_request('playlistdelete "name" "5"') self.assertEqualResponse('ACK [0@0] {playlistdelete} Not implemented') def test_playlistmove(self): - self.sendRequest('playlistmove "name" "5" "10"') + self.send_request('playlistmove "name" "5" "10"') self.assertEqualResponse('ACK [0@0] {playlistmove} Not implemented') def test_rename(self): - self.sendRequest('rename "old_name" "new_name"') + self.send_request('rename "old_name" "new_name"') self.assertEqualResponse('ACK [0@0] {rename} Not implemented') def test_rm(self): - self.sendRequest('rm "name"') + self.send_request('rm "name"') self.assertEqualResponse('ACK [0@0] {rm} Not implemented') def test_save(self): - self.sendRequest('save "name"') + self.send_request('save "name"') self.assertEqualResponse('ACK [0@0] {save} Not implemented')