From 1c66c5662f81e29ca596aefdef569b896d784226 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Wed, 10 May 2017 21:40:40 -0700 Subject: [PATCH] Fixed tests --- rtv/clipboard.py | 3 +-- rtv/page.py | 4 ++-- ...oard_linux.py => test_copy_to_clipboard_linux.yaml} | 0 tests/test_submission.py | 10 +++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) rename tests/cassettes/{test_copy_to_clipboard_linux.py => test_copy_to_clipboard_linux.yaml} (100%) diff --git a/rtv/clipboard.py b/rtv/clipboard.py index 0a730e5..4194b4c 100644 --- a/rtv/clipboard.py +++ b/rtv/clipboard.py @@ -46,7 +46,6 @@ def copy_linux(text): cmd_name = get_command_name() if cmd_name is None: - raise ProgramError("External copy application not found,\n" - "try installing either `xsel` or `xclip`") + raise ProgramError("External copy application not found") _subprocess_copy(text, cmd_args.get(cmd_name)) diff --git a/rtv/page.py b/rtv/page.py index 0fb9340..d71e597 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -340,7 +340,7 @@ class Page(object): except (ProgramError, OSError) as e: _logger.exception(e) self.term.show_notification( - 'Failed to copy permalink to clipboard\n{0}'.format(e)) + 'Failed to copy permalink: {0}'.format(e)) else: self.term.show_notification( 'Copied permalink to clipboard', timeout=1) @@ -362,7 +362,7 @@ class Page(object): except (ProgramError, OSError) as e: _logger.exception(e) self.term.show_notification( - 'Failed to copy url to clipboard\n{0}'.format(e)) + 'Failed to copy url: {0}'.format(e)) else: self.term.show_notification( 'Copied url to clipboard', timeout=1) diff --git a/tests/cassettes/test_copy_to_clipboard_linux.py b/tests/cassettes/test_copy_to_clipboard_linux.yaml similarity index 100% rename from tests/cassettes/test_copy_to_clipboard_linux.py rename to tests/cassettes/test_copy_to_clipboard_linux.yaml diff --git a/tests/test_submission.py b/tests/test_submission.py index 837ceb9..ad69377 100644 --- a/tests/test_submission.py +++ b/tests/test_submission.py @@ -520,13 +520,17 @@ def test_copy_to_clipboard_linux(submission_page, terminal, refresh_token): assert data.get('permalink') == content window.addstr.assert_called_with(1, 1, b'Copied permalink to clipboard') else: - window.addstr.assert_called_with(1, 1, b'Failed to copy permalink to clipboard') + # Nither xclip or xsel installed, this is what happens on Travis CI + text = b'Failed to copy permalink: External copy application not found' + window.addstr.assert_called_with(1, 1, text) - # Trigger copy command for submission + # Trigger copy command for url submission_page.controller.trigger('Y') content = get_clipboard_content() if content is not None: assert data.get('url_full') == content window.addstr.assert_called_with(1, 1, b'Copied url to clipboard') else: - window.addstr.assert_called_with(1, 1, b'Failed to copy url to clipboard') + # Nither xclip or xsel installed, this is what happens on Travis CI + text = b'Failed to copy url: External copy application not found' + window.addstr.assert_called_with(1, 1, text) \ No newline at end of file