diff options
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -70,6 +70,18 @@ class poloniexETest(unittest.TestCase): | |||
70 | self.wm.stop() | 70 | self.wm.stop() |
71 | super(poloniexETest, self).tearDown() | 71 | super(poloniexETest, self).tearDown() |
72 | 72 | ||
73 | def test__init(self): | ||
74 | with mock.patch("market.ccxt.poloniexE.session") as session: | ||
75 | session.request.return_value = "response" | ||
76 | ccxt = market.ccxt.poloniexE() | ||
77 | ccxt._market = mock.Mock | ||
78 | ccxt._market.report = mock.Mock() | ||
79 | |||
80 | ccxt.session.request("GET", "URL", data="data", | ||
81 | headers="headers") | ||
82 | ccxt._market.report.log_http_request.assert_called_with('GET', 'URL', 'data', | ||
83 | 'headers', 'response') | ||
84 | |||
73 | def test_nanoseconds(self): | 85 | def test_nanoseconds(self): |
74 | with mock.patch.object(market.ccxt.time, "time") as time: | 86 | with mock.patch.object(market.ccxt.time, "time") as time: |
75 | time.return_value = 123456.7890123456 | 87 | time.return_value = 123456.7890123456 |
@@ -1177,17 +1189,11 @@ class MarketTest(WebMockTestCase): | |||
1177 | def test_from_config(self, ccxt): | 1189 | def test_from_config(self, ccxt): |
1178 | with mock.patch("market.ReportStore"): | 1190 | with mock.patch("market.ReportStore"): |
1179 | ccxt.poloniexE.return_value = self.ccxt | 1191 | ccxt.poloniexE.return_value = self.ccxt |
1180 | self.ccxt.session.request.return_value = "response" | ||
1181 | 1192 | ||
1182 | m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args()) | 1193 | m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args()) |
1183 | 1194 | ||
1184 | self.assertEqual(self.ccxt, m.ccxt) | 1195 | self.assertEqual(self.ccxt, m.ccxt) |
1185 | 1196 | ||
1186 | self.ccxt.session.request("GET", "URL", data="data", | ||
1187 | headers="headers") | ||
1188 | m.report.log_http_request.assert_called_with('GET', 'URL', 'data', | ||
1189 | 'headers', 'response') | ||
1190 | |||
1191 | m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args(debug=True)) | 1197 | m = market.Market.from_config({"key": "key", "secred": "secret"}, self.market_args(debug=True)) |
1192 | self.assertEqual(True, m.debug) | 1198 | self.assertEqual(True, m.debug) |
1193 | 1199 | ||