working on initial lambda support

This commit is contained in:
Gert Wohlgemuth
2018-05-09 09:09:17 -07:00
parent 9d844696f9
commit f667041679
7 changed files with 272 additions and 0 deletions

View File

View File

@@ -0,0 +1,7 @@
import pytest
from freqtrade.aws.backtesting_lambda import backtest
def test_backtest(lambda_context):
backtest({}, {})

View File

@@ -15,6 +15,10 @@ from freqtrade.analyze import Analyze
from freqtrade import constants
from freqtrade.freqtradebot import FreqtradeBot
import moto
import boto3
import os
logging.getLogger('').setLevel(logging.INFO)
@@ -585,3 +589,34 @@ def buy_order_fee():
'status': 'closed',
'fee': None
}
@pytest.fixture
def lambda_context():
# mock the different AWS features we need
sns = moto.mock_sns()
sns.start()
dynamo = moto.mock_dynamodb2()
dynamo.start()
lamb = moto.mock_lambda()
lamb.start()
session = boto3.session.Session()
client = session.client('sns')
os.environ["topic"] = "UnitTestTopic"
os.environ["trackingTable"] = "UnitTrackingTable"
os.environ["acquisitionTable"] = "UnitAcquisitionTable"
os.environ["resultTable"] = "UnitResultTable"
dynamodb = boto3.resource('dynamodb')
# here we will define required tables later
yield
sns.stop()
dynamo.stop()
lamb.stop()