mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 03:56:01 +00:00
#1215: Initiate settings before printing the alias
This commit is contained in:
parent
58f61d8090
commit
58ddd4338a
@ -1,6 +1,6 @@
|
||||
from mock import Mock
|
||||
import pytest
|
||||
from thefuck.entrypoints.alias import _get_alias
|
||||
from thefuck.entrypoints.alias import _get_alias, print_alias
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -28,3 +28,12 @@ def test_get_alias(monkeypatch, mocker, py2,
|
||||
assert alias == 'instant_mode_alias'
|
||||
else:
|
||||
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)
|
||||
|
@ -1,4 +1,5 @@
|
||||
import six
|
||||
from ..conf import settings
|
||||
from ..logs import warn
|
||||
from ..shells import shell
|
||||
from ..utils import which
|
||||
@ -23,4 +24,5 @@ def _get_alias(known_args):
|
||||
|
||||
|
||||
def print_alias(known_args):
|
||||
settings.init(known_args)
|
||||
print(_get_alias(known_args))
|
||||
|
Loading…
Reference in New Issue
Block a user