Increase Configuration._load_config_file() code coverage
This commit is contained in:
parent
ea7b25766b
commit
a8fd7a69ab
@ -7,6 +7,7 @@ import json
|
|||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import pytest
|
import pytest
|
||||||
|
from unittest.mock import MagicMock
|
||||||
from jsonschema import ValidationError
|
from jsonschema import ValidationError
|
||||||
|
|
||||||
from freqtrade.arguments import Arguments
|
from freqtrade.arguments import Arguments
|
||||||
@ -67,6 +68,24 @@ def test_load_config_file(default_conf, mocker, caplog) -> None:
|
|||||||
assert log_has('Validating configuration ...', caplog.record_tuples)
|
assert log_has('Validating configuration ...', caplog.record_tuples)
|
||||||
|
|
||||||
|
|
||||||
|
def test_load_config_file_exception(mocker, caplog) -> None:
|
||||||
|
"""
|
||||||
|
Test Configuration._load_config_file() method
|
||||||
|
"""
|
||||||
|
mocker.patch(
|
||||||
|
'freqtrade.configuration.open',
|
||||||
|
MagicMock(side_effect=FileNotFoundError('File not found'))
|
||||||
|
)
|
||||||
|
configuration = Configuration([])
|
||||||
|
|
||||||
|
with pytest.raises(SystemExit):
|
||||||
|
configuration._load_config_file('somefile')
|
||||||
|
assert log_has(
|
||||||
|
'Config file "somefile" not found. Please create your config file',
|
||||||
|
caplog.record_tuples
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_load_config(default_conf, mocker) -> None:
|
def test_load_config(default_conf, mocker) -> None:
|
||||||
"""
|
"""
|
||||||
Test Configuration.load_config() without any cli params
|
Test Configuration.load_config() without any cli params
|
||||||
|
Loading…
Reference in New Issue
Block a user