diff --git a/groove/playlist.py b/groove/playlist.py index 12c46b8..203db1d 100644 --- a/groove/playlist.py +++ b/groove/playlist.py @@ -14,9 +14,6 @@ from sqlalchemy.orm.session import Session from sqlalchemy.engine.row import Row from sqlalchemy.exc import NoResultFound, MultipleResultsFound -from rich.table import Table, Column -from rich import box - from yaml.scanner import ScannerError diff --git a/test/fixtures/env b/test/fixtures/env index 3ed12aa..51e899f 100644 --- a/test/fixtures/env +++ b/test/fixtures/env @@ -22,3 +22,7 @@ MEDIA_GLOB=*.mp3,*.flac,*.m4a # Set this value to enable debugging DEBUG=1 + +EDITOR=ed +CONSOLE_THEMES=True +CONSOLE_WIDTH=80 diff --git a/test/test_playlists.py b/test/test_playlists.py index 52805ca..db30fd3 100644 --- a/test/test_playlists.py +++ b/test/test_playlists.py @@ -132,7 +132,7 @@ def test_playlist_inequality_tracks_differ(db): def test_as_yaml(db): expected = { 'playlist one': { - 'description': 'the first one', + 'description': 'the first one\n', 'entries': [ {'UNKLE': 'Guns Blazing'}, {'UNKLE': 'UNKLE'}, diff --git a/test/test_shell.py b/test/test_shell.py index acf65b5..a7a7c07 100644 --- a/test/test_shell.py +++ b/test/test_shell.py @@ -6,7 +6,7 @@ from unittest.mock import MagicMock @pytest.fixture -def cmd_prompt(in_memory_engine, db): +def cmd_prompt(monkeypatch, in_memory_engine, db): with database_manager() as manager: manager._session = db yield interactive_shell.CommandPrompt(manager) @@ -20,7 +20,7 @@ def response_factory(responses): (['stats'], 'Database contains 4 playlists'), # match the db fixture ]) def test_stats(monkeypatch, capsys, cmd_prompt, inputs, expected): - monkeypatch.setattr('groove.shell.base.prompt', response_factory(inputs)) + monkeypatch.setattr('groove.console.Console.prompt', response_factory(inputs)) cmd_prompt.start() output = capsys.readouterr() assert expected in output.out @@ -30,13 +30,13 @@ def test_stats(monkeypatch, capsys, cmd_prompt, inputs, expected): (['quit'], SystemExit), ]) def test_quit(monkeypatch, capsys, cmd_prompt, inputs, expected): - monkeypatch.setattr('groove.shell.base.prompt', response_factory(inputs)) + monkeypatch.setattr('groove.console.Console.prompt', response_factory(inputs)) with pytest.raises(expected): cmd_prompt.start() def test_browse(monkeypatch, capsys, cmd_prompt): - monkeypatch.setattr('groove.shell.base.prompt', response_factory(['browse'])) + monkeypatch.setattr('groove.console.Console.prompt', response_factory(['browse'])) cmd_prompt.start() output = capsys.readouterr() assert 'Displaying 4 playlists' in output.out @@ -49,11 +49,11 @@ def test_browse(monkeypatch, capsys, cmd_prompt): @pytest.mark.parametrize('inputs, expected', [ - ('help', ['Available Commands', ' help ', ' stats ', ' browse ']), - ('help browse', ['Help for browse']), + (['help'], ['Available Commands', ' help ', ' stats ', ' browse ']), + (['help browse'], ['Help for browse']), ]) def test_help(monkeypatch, capsys, cmd_prompt, inputs, expected): - monkeypatch.setattr('groove.shell.base.prompt', response_factory([inputs])) + monkeypatch.setattr('groove.console.Console.prompt', response_factory(inputs)) cmd_prompt.start() output = capsys.readouterr() for txt in expected: @@ -62,12 +62,12 @@ def test_help(monkeypatch, capsys, cmd_prompt, inputs, expected): @pytest.mark.parametrize('inputs, expected', [ - ('load A New Playlist', 'a-new-playlist'), - ('new playlist', 'new-playlist'), - ('load', '') + (['load A New Playlist'], 'a-new-playlist'), + (['new playlist'], 'new-playlist'), + (['load'], '') ]) def test_load(monkeypatch, caplog, cmd_prompt, inputs, expected): - monkeypatch.setattr('groove.shell.base.prompt', response_factory([inputs])) + monkeypatch.setattr('groove.console.Console.prompt', response_factory(inputs)) cmd_prompt.start() assert expected in caplog.text