Move tests to *protocol*/stored_playlists_test.py

This commit is contained in:
alzeih 2013-08-06 22:22:18 +12:00
parent 7182f98843
commit 333f1c0dbf
2 changed files with 24 additions and 28 deletions

View File

@ -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)

View File

@ -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)