]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - tests/test_ccxt_wrapper.py
Fix ccxt switching currency codes
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / tests / test_ccxt_wrapper.py
index d32469a83cee251933dc1176c75f84c1e1d9c812..18feab32da53f3252541b116aee3fa13052ba11e 100644 (file)
@@ -1,8 +1,7 @@
-from .helper import limits, unittest, mock, D
+from .helper import unittest, mock, D
 import requests_mock
 import market
 
-@unittest.skipUnless("unit" in limits, "Unit skipped")
 class poloniexETest(unittest.TestCase):
     def setUp(self):
         super().setUp()
@@ -22,11 +21,13 @@ class poloniexETest(unittest.TestCase):
             ccxt = market.ccxt.poloniexE()
             ccxt._market = mock.Mock
             ccxt._market.report = mock.Mock()
+            ccxt._market.market_id = 3
+            ccxt._market.user_id = 3
 
             ccxt.session.request("GET", "URL", data="data",
-                    headers="headers")
+                    headers={})
             ccxt._market.report.log_http_request.assert_called_with('GET', 'URL', 'data',
-                    'headers', 'response')
+                    {'X-market-id': '3', 'X-user-id': '3'}, 'response')
 
         with self.subTest("Raising"),\
                 mock.patch("market.ccxt.poloniexE.session") as session:
@@ -35,12 +36,14 @@ class poloniexETest(unittest.TestCase):
             ccxt = market.ccxt.poloniexE()
             ccxt._market = mock.Mock
             ccxt._market.report = mock.Mock()
+            ccxt._market.market_id = 3
+            ccxt._market.user_id = 3
 
             with self.assertRaises(market.ccxt.RequestException, msg="Boo") as cm:
                 ccxt.session.request("GET", "URL", data="data",
-                        headers="headers")
+                        headers={})
             ccxt._market.report.log_http_request.assert_called_with('GET', 'URL', 'data',
-                    'headers', cm.exception)
+                    {'X-market-id': '3', 'X-user-id': '3'}, cm.exception)
 
 
     def test_nanoseconds(self):
@@ -474,4 +477,8 @@ class poloniexETest(unittest.TestCase):
 
             create_order.assert_called_once_with("symbol", "type", "side", "amount", price="price", params="params")
 
+    def test_common_currency_code(self):
+        self.assertEqual("FOO", self.s.common_currency_code("FOO"))
 
+    def test_currency_id(self):
+        self.assertEqual("FOO", self.s.currency_id("FOO"))