diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-03-22 16:11:32 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-03-22 16:11:32 +0100 |
commit | 78ded184e2c7cbb0bf62fc5becd4e4dd3dc59cc0 (patch) | |
tree | 5eafe7f8fbc1a707f238f1b73ccae0172be24010 | |
parent | 34865e65933da0db778e171fc787eca114ec562d (diff) | |
parent | 8bbca32edc344c7ee2f5ea5db5448a4c4ff79684 (diff) | |
download | Trader-78ded184e2c7cbb0bf62fc5becd4e4dd3dc59cc0.tar.gz Trader-78ded184e2c7cbb0bf62fc5becd4e4dd3dc59cc0.tar.zst Trader-78ded184e2c7cbb0bf62fc5becd4e4dd3dc59cc0.zip |
-rw-r--r-- | tests/helper.py | 6 | ||||
-rw-r--r-- | tests/test_portfolio.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/helper.py b/tests/helper.py index a2f8a22..930d04a 100644 --- a/tests/helper.py +++ b/tests/helper.py | |||
@@ -5,9 +5,10 @@ from unittest import mock | |||
5 | import requests_mock | 5 | import requests_mock |
6 | from io import StringIO | 6 | from io import StringIO |
7 | import portfolio, market, main, store, dbs | 7 | import portfolio, market, main, store, dbs |
8 | import datetime | ||
8 | 9 | ||
9 | __all__ = ["limits", "unittest", "WebMockTestCase", "mock", "D", | 10 | __all__ = ["limits", "unittest", "WebMockTestCase", "mock", "D", |
10 | "StringIO"] | 11 | "StringIO", "tz"] |
11 | 12 | ||
12 | limits = ["acceptance", "unit"] | 13 | limits = ["acceptance", "unit"] |
13 | for test_type in limits: | 14 | for test_type in limits: |
@@ -19,6 +20,9 @@ for test_type in limits: | |||
19 | limits = [test_type] | 20 | limits = [test_type] |
20 | break | 21 | break |
21 | 22 | ||
23 | def tz(hours): | ||
24 | return datetime.timezone(datetime.timedelta(hours=hours)) | ||
25 | |||
22 | class WebMockTestCase(unittest.TestCase): | 26 | class WebMockTestCase(unittest.TestCase): |
23 | import time | 27 | import time |
24 | 28 | ||
diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py index cad3095..f2f6394 100644 --- a/tests/test_portfolio.py +++ b/tests/test_portfolio.py | |||
@@ -1361,7 +1361,7 @@ class OrderTest(WebMockTestCase): | |||
1361 | with self.subTest(similar_open_order=True): | 1361 | with self.subTest(similar_open_order=True): |
1362 | order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"), | 1362 | order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"), |
1363 | D("0.1"), "BTC", "long", self.m, "trade") | 1363 | D("0.1"), "BTC", "long", self.m, "trade") |
1364 | order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55) | 1364 | order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55, 0, tz(2)) |
1365 | 1365 | ||
1366 | self.m.ccxt.order_precision.return_value = 8 | 1366 | self.m.ccxt.order_precision.return_value = 8 |
1367 | self.m.ccxt.fetch_orders.return_value = [ | 1367 | self.m.ccxt.fetch_orders.return_value = [ |
@@ -1471,7 +1471,7 @@ class OrderTest(WebMockTestCase): | |||
1471 | with self.subTest(similar_open_order=False, past_trades=True): | 1471 | with self.subTest(similar_open_order=False, past_trades=True): |
1472 | order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"), | 1472 | order = portfolio.Order("buy", portfolio.Amount("ETH", "0.001"), |
1473 | D("0.1"), "BTC", "long", self.m, "trade") | 1473 | D("0.1"), "BTC", "long", self.m, "trade") |
1474 | order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55) | 1474 | order.start_date = datetime.datetime(2018, 3, 25, 15, 15, 55, 0, tz(2)) |
1475 | 1475 | ||
1476 | self.m.ccxt.order_precision.return_value = 8 | 1476 | self.m.ccxt.order_precision.return_value = 8 |
1477 | self.m.ccxt.fetch_orders.return_value = [] | 1477 | self.m.ccxt.fetch_orders.return_value = [] |