Beispiel #1
0
 def test_prepare_uses_custom_class_if_available(self, mock_prep_prepare):
     request = BitexRequest(url="test:instrument/ticker")
     custom_class = MagicMock(name="PseudoCustomClass")
     custom_class.return_value = custom_class
     assert request.exchange == "test"
     with patch.dict("bitex.request.PLUGINS",
                     {"test": {
                         "PreparedRequest": custom_class
                     }}):
         assert request.prepare() == custom_class
     assert not mock_prep_prepare.called
     assert custom_class.called
     custom_class.assert_called_once_with("test")
Beispiel #2
0
 def test_prepare_defaults_to_bitex_prepared_request_if_no_custom_class_is_available(
         self, _):
     request = BitexRequest(url="test:instrument/endpoint")
     assert isinstance(request.prepare(), BitexPreparedRequest)