mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
d41cbb6810
heroku updated its command suggestion formatting, so account for that. For example: $ heroku log ▸ log is not a heroku command. ▸ Perhaps you meant logs? ▸ Run heroku _ to run heroku logs. ▸ Run heroku help for a list of available commands. $ fuck heroku logs [enter/↑/↓/ctrl+c]
32 lines
878 B
Python
32 lines
878 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import pytest
|
|
from tests.utils import Command
|
|
from thefuck.rules.heroku_not_command import match, get_new_command
|
|
|
|
|
|
suggest_stderr = '''
|
|
▸ log is not a heroku command.
|
|
▸ Perhaps you meant logs?
|
|
▸ Run heroku _ to run heroku logs.
|
|
▸ Run heroku help for a list of available commands.'''
|
|
|
|
|
|
@pytest.mark.parametrize('cmd', ['log'])
|
|
def test_match(cmd):
|
|
assert match(
|
|
Command('heroku {}'.format(cmd), stderr=suggest_stderr))
|
|
|
|
|
|
@pytest.mark.parametrize('script, stderr', [
|
|
('cat log', suggest_stderr)])
|
|
def test_not_match(script, stderr):
|
|
assert not match(Command(script, stderr=stderr))
|
|
|
|
|
|
@pytest.mark.parametrize('cmd, result', [
|
|
('log', 'heroku logs')])
|
|
def test_get_new_command(cmd, result):
|
|
command = Command('heroku {}'.format(cmd), stderr=suggest_stderr)
|
|
assert get_new_command(command) == result
|