From 333f1c0dbfe0f436b05e7209e78da2daa8e9c8aa Mon Sep 17 00:00:00 2001 From: alzeih Date: Tue, 6 Aug 2013 22:22:18 +1200 Subject: [PATCH] Move tests to *protocol*/stored_playlists_test.py --- .../mpd/protocol/stored_playlists_test.py | 24 ++++++++++++++++ tests/frontends/mpd/stored_playlists_test.py | 28 ------------------- 2 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 tests/frontends/mpd/stored_playlists_test.py diff --git a/tests/frontends/mpd/protocol/stored_playlists_test.py b/tests/frontends/mpd/protocol/stored_playlists_test.py index 8199be2b..820096f4 100644 --- a/tests/frontends/mpd/protocol/stored_playlists_test.py +++ b/tests/frontends/mpd/protocol/stored_playlists_test.py @@ -107,6 +107,30 @@ class PlaylistsHandlerTest(protocol.BaseTestCase): 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.assertInResponse('playlist: a ') + self.assertNotInResponse('playlist: a\n') + self.assertInResponse('OK') + + def test_listplaylists_replaces_carriage_return_with_space(self): + self.backend.playlists.playlists = [ + Playlist(name='a\r', uri='dummy:')] + self.sendRequest('listplaylists') + self.assertInResponse('playlist: a ') + self.assertNotInResponse('playlist: a\r') + self.assertInResponse('OK') + + def test_listplaylists_replaces_forward_slash_with_space(self): + self.backend.playlists.playlists = [ + Playlist(name='a/', uri='dummy:')] + self.sendRequest('listplaylists') + self.assertInResponse('playlist: a ') + self.assertNotInResponse('playlist: a/') + self.assertInResponse('OK') + def test_load_appends_to_tracklist(self): self.core.tracklist.add([Track(uri='a'), Track(uri='b')]) self.assertEqual(len(self.core.tracklist.tracks.get()), 2) diff --git a/tests/frontends/mpd/stored_playlists_test.py b/tests/frontends/mpd/stored_playlists_test.py deleted file mode 100644 index 2c647681..00000000 --- a/tests/frontends/mpd/stored_playlists_test.py +++ /dev/null @@ -1,28 +0,0 @@ -from __future__ import unicode_literals - -import unittest - -from mopidy.frontends.mpd.dispatcher import MpdContext, MpdDispatcher - - -class MpdContextTest(unittest.TestCase): - def setUp(self): - config = { - 'mpd': { - 'password': None, - } - } - dispatcher = MpdDispatcher(config=config) - self.context = dispatcher.context - - def test_create_unique_name_replaces_newlines_with_space(self): - result = self.context.create_unique_name("playlist name\n") - self.assertEqual("playlist name ", result) - - def test_create_unique_name_replaces_carriage_returns_with_space(self): - result = self.context.create_unique_name("playlist name\r") - self.assertEqual("playlist name ", result) - - def test_create_unique_name_replaces_forward_slashes_with_space(self): - result = self.context.create_unique_name("playlist name/") - self.assertEqual("playlist name ", result)