try running analyze_ticker with mock data

This commit is contained in:
Janne Sinivirta 2017-09-24 17:23:29 +03:00
parent 9b63f02e1c
commit f3ccca1c66

16
test/test_backtesting.py Normal file
View File

@ -0,0 +1,16 @@
# pragma pylint: disable=missing-docstring
import unittest
from unittest.mock import patch
import json
import arrow
from analyze import analyze_ticker
class TestMain(unittest.TestCase):
def test_1_create_trade(self):
with open('test/testdata/btc-neo.json') as data_file:
data = json.load(data_file)
with patch('analyze.get_ticker', return_value=data):
with patch('arrow.utcnow', return_value=arrow.get('2017-08-20T14:50:00')):
print(analyze_ticker('BTC-NEO'))