def test_on_first_run_from_current_shell(usage_tracker_io, shell_pid, shell, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 main() _assert_tracker_updated(usage_tracker_io, 12) logs.how_to_configure_alias.assert_called_once()
def test_when_already_configured(usage_tracker_io, shell_pid, shell, shell_config, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 _change_tracker(usage_tracker_io, 12) shell_config.read.return_value = 'eval $(thefuck --alias)' main() logs.already_configured.assert_called_once()
def test_when_already_configured(usage_tracker, shell_pid, shell, shell_config, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 _change_tracker(usage_tracker, 12) shell_config.read.return_value = 'eval $(thefuck --alias)' main() logs.already_configured.assert_called_once()
def test_on_first_run_from_current_shell(usage_tracker, shell_pid, shell, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 _change_tracker(usage_tracker, 55) main() _assert_tracker_updated(usage_tracker, 12) logs.how_to_configure_alias.assert_called_once()
def test_when_successfully_configured(usage_tracker_io, shell_pid, shell, shell_config, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 _change_tracker(usage_tracker_io, 12) shell_config.read.return_value = '' main() shell_config.write.assert_any_call('eval $(thefuck --alias)') logs.configured_successfully.assert_called_once()
def test_when_cant_configure_automatically(shell_pid, shell, logs): shell_pid.return_value = 12 shell.how_to_configure.return_value = ShellConfiguration( content='eval $(thefuck --alias)', path='/tmp/.bashrc', reload='bash', can_configure_automatically=False) main() logs.how_to_configure_alias.assert_called_once()
def test_when_cant_configure_automatically(shell_pid, shell, logs): shell_pid.return_value = 12 shell.how_to_configure.return_value = ShellConfiguration( content='eval $(thefuck --alias)', path='/tmp/.bashrc', reload='bash', can_configure_automatically=False) main() logs.how_to_configure_alias.assert_called_once()
def test_when_successfuly_configured(usage_tracker, shell_pid, shell, shell_config, logs): shell.get_history.return_value = ['f**k'] shell_pid.return_value = 12 _change_tracker(usage_tracker, 12) shell_config.read.return_value = '' main() shell_config.write.assert_any_call('eval $(thefuck --alias)') logs.configured_successfully.assert_called_once()
def test_on_run_after_other_commands(usage_tracker_io, shell_pid, shell, logs): shell_pid.return_value = 12 shell.get_history.return_value = ['f**k', 'ls'] _change_tracker(usage_tracker_io, 12) main() logs.how_to_configure_alias.assert_called_once()
def test_on_first_run(usage_tracker_io, usage_tracker_exists, shell_pid, logs): shell_pid.return_value = 12 main() usage_tracker_exists.return_value = False _assert_tracker_updated(usage_tracker_io, 12) logs.how_to_configure_alias.assert_called_once()
def test_for_generic_shell(shell, logs): shell.how_to_configure.return_value = None main() logs.how_to_configure_alias.assert_called_once()
def test_on_run_after_other_commands(usage_tracker, shell_pid, shell, logs): shell_pid.return_value = 12 shell.is_last_history_item_good.return_value = False _change_tracker(usage_tracker, 12) main() logs.how_to_configure_alias.assert_called_once()
def test_on_run_after_other_commands(usage_tracker, shell_pid, shell, logs): shell_pid.return_value = 12 shell.get_history.return_value = ['f**k', 'ls'] _change_tracker(usage_tracker, 12) main() logs.how_to_configure_alias.assert_called_once()
def test_on_first_run(usage_tracker, shell_pid, logs): shell_pid.return_value = 12 usage_tracker.return_value.exists.return_value = False main() _assert_tracker_updated(usage_tracker, 12) logs.how_to_configure_alias.assert_called_once()
def test_for_generic_shell(shell, logs): shell.how_to_configure.return_value = None main() logs.how_to_configure_alias.assert_called_once()
def test_on_run_after_other_commands(usage_tracker, shell_pid, shell, logs): shell_pid.return_value = 12 shell.is_last_history_item_good.return_value = False _change_tracker(usage_tracker, 12) main() logs.how_to_configure_alias.assert_called_once()