1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-04-17 08:10:47 +01:00
thefuck/tests/rules/test_brew_cask_reinstall.py
Pavlos Vinieratos 3f0e3b538e
Update tests/rules/test_brew_cask_reinstall.py
Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
2019-12-02 16:26:02 +01:00

29 lines
843 B
Python

import pytest
from thefuck.types import Command
from thefuck.rules.brew_cask_reinstall import get_new_command, match
output = ("Warning: Cask 'thefuck' is already installed.\n\nTo "
"re-install thefuck, run:\n brew cask reinstall thefuck")
def test_match():
command = Command('brew cask install thefuck', output)
assert match(command)
@pytest.mark.parametrize('script', [
'brew cask reinstall thefuck',
'brew install foo'])
def test_not_match(script):
assert not match(Command(script, ''))
@pytest.mark.parametrize('script, formula, ', [
('brew install foo', 'foo'),
('brew install bar zap', 'bar zap')])
def test_get_new_command(script, formula):
command = Command(script, output)
new_command = 'brew cask reinstall {}'.format(formula)
assert get_new_command(command) == new_command