file_dump_json

This commit is contained in:
kryofly
2018-01-11 15:49:04 +01:00
parent 69f68c428e
commit feb5da0c35
4 changed files with 19 additions and 6 deletions

View File

@@ -5,10 +5,11 @@ import argparse
from copy import deepcopy
import pytest
from unittest.mock import MagicMock
from jsonschema import ValidationError
from freqtrade.misc import throttle, parse_args, load_config,\
parse_args_common
parse_args_common, file_dump_json
def test_throttle():
@@ -135,6 +136,14 @@ def test_parse_args_hyperopt_custom(mocker):
assert call_args.func is not None
def test_file_dump_json(default_conf, mocker):
file_open = mocker.patch('freqtrade.misc.open', MagicMock())
json_dump = mocker.patch('json.dump', MagicMock())
file_dump_json('somefile', [1, 2, 3])
assert file_open.call_count == 1
assert json_dump.call_count == 1
def test_load_config(default_conf, mocker):
file_mock = mocker.patch('freqtrade.misc.open', mocker.mock_open(
read_data=json.dumps(default_conf)