From 445b4a7712fb7fe45e17b6b76356dd3be42dd900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 24 Mar 2018 15:18:56 +0100 Subject: Move request wrapper to ccxt --- test.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'test.py') diff --git a/test.py b/test.py index 40c64a9..18616c1 100644 --- a/test.py +++ b/test.py @@ -70,6 +70,18 @@ class poloniexETest(unittest.TestCase): self.wm.stop() super(poloniexETest, self).tearDown() + def test__init(self): + with mock.patch("market.ccxt.poloniexE.session") as session: + session.request.return_value = "response" + ccxt = market.ccxt.poloniexE() + ccxt._market = mock.Mock + ccxt._market.report = mock.Mock() + + ccxt.session.request("GET", "URL", data="data", + headers="headers") + ccxt._market.report.log_http_request.assert_called_with('GET', 'URL', 'data', + 'headers', 'response') + def test_nanoseconds(self): with mock.patch.object(market.ccxt.time, "time") as time: time.return_value = 123456.7890123456 @@ -1177,17 +1189,11 @@ class MarketTest(WebMockTestCase): def test_from_config(self, ccxt): with mock.patch("market.ReportStore"): ccxt.poloniexE.return_value = self.ccxt - self.ccxt.session.request.return_value = "response" m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args()) self.assertEqual(self.ccxt, m.ccxt) - self.ccxt.session.request("GET", "URL", data="data", - headers="headers") - m.report.log_http_request.assert_called_with('GET', 'URL', 'data', - 'headers', 'response') - m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args(debug=True)) self.assertEqual(True, m.debug) -- cgit v1.2.3