1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-18 20:11:17 +00:00

#1215: Initiate settings before printing the alias

This commit is contained in:
Pablo Santiago Blum de Aguiar 2021-07-18 15:48:03 +02:00 committed by Pablo Aguiar
parent 58f61d8090
commit 58ddd4338a
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
from mock import Mock from mock import Mock
import pytest import pytest
from thefuck.entrypoints.alias import _get_alias from thefuck.entrypoints.alias import _get_alias, print_alias
@pytest.mark.parametrize( @pytest.mark.parametrize(
@ -28,3 +28,12 @@ def test_get_alias(monkeypatch, mocker, py2,
assert alias == 'instant_mode_alias' assert alias == 'instant_mode_alias'
else: else:
assert alias == 'app_alias' assert alias == 'app_alias'
def test_print_alias(mocker):
settings_mock = mocker.patch('thefuck.entrypoints.alias.settings')
_get_alias_mock = mocker.patch('thefuck.entrypoints.alias._get_alias')
known_args = Mock()
print_alias(known_args)
settings_mock.init.assert_called_once_with(known_args)
_get_alias_mock.assert_called_once_with(known_args)

View File

@ -1,4 +1,5 @@
import six import six
from ..conf import settings
from ..logs import warn from ..logs import warn
from ..shells import shell from ..shells import shell
from ..utils import which from ..utils import which
@ -23,4 +24,5 @@ def _get_alias(known_args):
def print_alias(known_args): def print_alias(known_args):
settings.init(known_args)
print(_get_alias(known_args)) print(_get_alias(known_args))