From f3ccca1c66f320d3897101f266e82a4335aafde4 Mon Sep 17 00:00:00 2001 From: Janne Sinivirta Date: Sun, 24 Sep 2017 17:23:29 +0300 Subject: [PATCH] try running analyze_ticker with mock data --- test/test_backtesting.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/test_backtesting.py diff --git a/test/test_backtesting.py b/test/test_backtesting.py new file mode 100644 index 000000000..ab2bff712 --- /dev/null +++ b/test/test_backtesting.py @@ -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'))