Avoid explicit config monkeypatching

This commit is contained in:
Luca Benci 2017-10-10 22:52:57 +02:00
parent 787e3db3d5
commit 052c527e4c

View File

@ -80,25 +80,23 @@ class TestCompletions:
"""Tests for completions.use_best_match."""
def test_dont_use_best_match(self, config_stub, monkeypatch):
def test_dont_use_best_match(self, config_stub):
"""Test multiple completion options with use_best_match set to false.
Should raise NoSuchCommandError
"""
config_stub.val.completion.use_best_match = False
monkeypatch.setattr('qutebrowser.config', config_stub)
parser = runners.CommandParser(partial_match=True)
with pytest.raises(cmdexc.NoSuchCommandError):
result = parser.parse('do')
def test_use_best_match(self, config_stub, monkeypatch):
def test_use_best_match(self, config_stub):
"""Test multiple completion options with use_best_match set to true.
The resulting command should be the best match
"""
config_stub.val.completion.use_best_match = True
monkeypatch.setattr('qutebrowser.config', config_stub)
parser = runners.CommandParser(partial_match=True)
result = parser.parse('do')