aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_market.py2
-rw-r--r--tests/test_portfolio.py26
2 files changed, 15 insertions, 13 deletions
diff --git a/tests/test_market.py b/tests/test_market.py
index 37c009b..0211638 100644
--- a/tests/test_market.py
+++ b/tests/test_market.py
@@ -890,7 +890,7 @@ class MarketTest(WebMockTestCase):
890 process.side_effect = Exception("bouh") 890 process.side_effect = Exception("bouh")
891 891
892 m.process(["some_action"], before=True) 892 m.process(["some_action"], before=True)
893 log_error.assert_called_with("market_process", exception=mock.ANY) 893 log_error.assert_called_with("market_process", exception=mock.ANY, message=mock.ANY)
894 store_report.assert_called_once() 894 store_report.assert_called_once()
895 895
896 896
diff --git a/tests/test_portfolio.py b/tests/test_portfolio.py
index 969f5d4..6ca3327 100644
--- a/tests/test_portfolio.py
+++ b/tests/test_portfolio.py
@@ -142,9 +142,9 @@ class TradeTest(WebMockTestCase):
142 142
143 self.assertTrue(trade.is_fullfiled) 143 self.assertTrue(trade.is_fullfiled)
144 144
145 order1.filled_amount.assert_called_with(in_base_currency=True) 145 order1.filled_amount.assert_called_with(in_base_currency=True, refetch=True)
146 order2.filled_amount.assert_called_with(in_base_currency=True) 146 order2.filled_amount.assert_called_with(in_base_currency=True, refetch=True)
147 order3.filled_amount.assert_called_with(in_base_currency=True) 147 order3.filled_amount.assert_called_with(in_base_currency=True, refetch=True)
148 148
149 with self.subTest(inverted=True): 149 with self.subTest(inverted=True):
150 value_from = portfolio.Amount("BTC", "0.5") 150 value_from = portfolio.Amount("BTC", "0.5")
@@ -169,9 +169,9 @@ class TradeTest(WebMockTestCase):
169 169
170 self.assertTrue(trade.is_fullfiled) 170 self.assertTrue(trade.is_fullfiled)
171 171
172 order1.filled_amount.assert_called_with(in_base_currency=False) 172 order1.filled_amount.assert_called_with(in_base_currency=False, refetch=True)
173 order2.filled_amount.assert_called_with(in_base_currency=False) 173 order2.filled_amount.assert_called_with(in_base_currency=False, refetch=True)
174 order3.filled_amount.assert_called_with(in_base_currency=False) 174 order3.filled_amount.assert_called_with(in_base_currency=False, refetch=True)
175 175
176 176
177 def test_filled_amount(self): 177 def test_filled_amount(self):
@@ -189,16 +189,16 @@ class TradeTest(WebMockTestCase):
189 trade.orders.append(order2) 189 trade.orders.append(order2)
190 190
191 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount()) 191 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount())
192 order1.filled_amount.assert_called_with(in_base_currency=False) 192 order1.filled_amount.assert_called_with(in_base_currency=False, refetch=False)
193 order2.filled_amount.assert_called_with(in_base_currency=False) 193 order2.filled_amount.assert_called_with(in_base_currency=False, refetch=False)
194 194
195 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount(in_base_currency=False)) 195 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount(in_base_currency=False))
196 order1.filled_amount.assert_called_with(in_base_currency=False) 196 order1.filled_amount.assert_called_with(in_base_currency=False, refetch=False)
197 order2.filled_amount.assert_called_with(in_base_currency=False) 197 order2.filled_amount.assert_called_with(in_base_currency=False, refetch=False)
198 198
199 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount(in_base_currency=True)) 199 self.assertEqual(portfolio.Amount("ETH", "0.31"), trade.filled_amount(in_base_currency=True))
200 order1.filled_amount.assert_called_with(in_base_currency=True) 200 order1.filled_amount.assert_called_with(in_base_currency=True, refetch=False)
201 order2.filled_amount.assert_called_with(in_base_currency=True) 201 order2.filled_amount.assert_called_with(in_base_currency=True, refetch=False)
202 202
203 @mock.patch.object(portfolio.Computation, "compute_value") 203 @mock.patch.object(portfolio.Computation, "compute_value")
204 @mock.patch.object(portfolio.Trade, "filled_amount") 204 @mock.patch.object(portfolio.Trade, "filled_amount")
@@ -863,6 +863,8 @@ class OrderTest(WebMockTestCase):
863 fetch.assert_not_called() 863 fetch.assert_not_called()
864 order.status = "open" 864 order.status = "open"
865 self.assertEqual(portfolio.Amount("ETH", 5), order.filled_amount(in_base_currency=False)) 865 self.assertEqual(portfolio.Amount("ETH", 5), order.filled_amount(in_base_currency=False))
866 fetch.assert_not_called()
867 self.assertEqual(portfolio.Amount("ETH", 5), order.filled_amount(in_base_currency=False, refetch=True))
866 fetch.assert_called_once() 868 fetch.assert_called_once()
867 self.assertEqual(portfolio.Amount("BTC", "0.7"), order.filled_amount(in_base_currency=True)) 869 self.assertEqual(portfolio.Amount("BTC", "0.7"), order.filled_amount(in_base_currency=True))
868 870