def test_load_rule(): match = object() get_new_command = object() with patch('thefuck.main.load_source', return_value=Mock( match=match, get_new_command=get_new_command)) as load_source: assert main.load_rule(Path('/rules/bash.py')) == main.Rule(match, get_new_command) load_source.assert_called_once_with('bash', '/rules/bash.py')
def test_load_rule(monkeypatch): match = object() get_new_command = object() load_source = Mock() load_source.return_value = Mock(match=match, get_new_command=get_new_command, enabled_by_default=True) monkeypatch.setattr('thefuck.main.load_source', load_source) assert main.load_rule(Path('/rules/bash.py')) \ == Rule('bash', match, get_new_command) load_source.assert_called_once_with('bash', '/rules/bash.py')
def test_load_rule(): match = object() get_new_command = object() with patch('thefuck.main.load_source', return_value=Mock( match=match, get_new_command=get_new_command, enabled_by_default=True)) as load_source: assert main.load_rule(Path('/rules/bash.py')) \ == types.Rule('bash', match, get_new_command, True) load_source.assert_called_once_with('bash', '/rules/bash.py')
def test_load_rule(mocker): match = object() get_new_command = object() load_source = mocker.patch('thefuck.main.load_source', return_value=Mock( match=match, get_new_command=get_new_command, enabled_by_default=True, priority=900)) assert main.load_rule(Path('/rules/bash.py')) \ == Rule('bash', match, get_new_command, priority=900) load_source.assert_called_once_with('bash', '/rules/bash.py')
def test_load_rule(mocker): match = object() get_new_command = object() load_source = mocker.patch( 'thefuck.main.load_source', return_value=Mock(match=match, get_new_command=get_new_command, enabled_by_default=True, priority=900)) assert main.load_rule(Path('/rules/bash.py')) \ == Rule('bash', match, get_new_command, priority=900) load_source.assert_called_once_with('bash', '/rules/bash.py')