def test_ensure_commands_returns_command(mocker): commands = {'xclip': ['xclip']} mocker.patch('passpie.clipboard.which', return_value=True) result = clipboard.ensure_commands(commands) assert result == commands['xclip']
def test_ensure_commands_raises_system_error_when_no_command_args(mocker): mocker.patch('passpie.clipboard.which', return_value=True) mock_commands = {k: [] for k, _ in clipboard.LINUX_COMMANDS.items()} with pytest.raises(SystemError): clipboard.ensure_commands(mock_commands)
def test_ensure_commands_raises_system_error_when_command_not_found(mocker): mocker.patch('passpie.clipboard.which', return_value=False) with pytest.raises(SystemError): clipboard.ensure_commands(clipboard.LINUX_COMMANDS)
def test_ensure_commands_logs_error_when_command_not_found(mocker): mocker.patch('passpie.clipboard.which', return_value=False) mock_logging = mocker.patch('passpie.clipboard.logging') clipboard.ensure_commands(clipboard.LINUX_COMMANDS) assert mock_logging.error.called