Esempio n. 1
0
def test_validate_pairs_not_available(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(return_value=[])
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    with pytest.raises(OperationalException, match=r'not available'):
        validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 2
0
def test_validate_pairs_not_available(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(return_value=[])
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    with pytest.raises(OperationalException, match=r'not available'):
        validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 3
0
def test_validate_pairs(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(
        return_value=['BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT'])
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 4
0
def test_validate_pairs(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(return_value=[
        'BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT', 'BTC_BCC',
    ])
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 5
0
def test_validate_pairs_not_compatible(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(return_value=['BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT'])
    default_conf['stake_currency'] = 'ETH'
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    with pytest.raises(RuntimeError, match=r'not compatible'):
        validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 6
0
def test_validate_pairs_not_compatible(default_conf, mocker):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(
        return_value=['BTC_ETH', 'BTC_TKN', 'BTC_TRST', 'BTC_SWT'])
    default_conf['stake_currency'] = 'ETH'
    mocker.patch('freqtrade.exchange._API', api_mock)
    mocker.patch.dict('freqtrade.exchange._CONF', default_conf)
    with pytest.raises(OperationalException, match=r'not compatible'):
        validate_pairs(default_conf['exchange']['pair_whitelist'])
Esempio n. 7
0
def test_validate_pairs_exception(default_conf, mocker, caplog):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(side_effect=RequestException())
    mocker.patch('freqtrade.exchange._API', api_mock)

    # with pytest.raises(RequestException, match=r'Unable to validate pairs'):
    validate_pairs(default_conf['exchange']['pair_whitelist'])
    assert ('freqtrade.exchange', logging.WARNING,
            'Unable to validate pairs (assuming they are correct). Reason: '
            ) in caplog.record_tuples
Esempio n. 8
0
def test_validate_pairs_exception(default_conf, mocker, caplog):
    api_mock = MagicMock()
    api_mock.get_markets = MagicMock(side_effect=RequestException())
    mocker.patch('freqtrade.exchange._API', api_mock)

    # with pytest.raises(RequestException, match=r'Unable to validate pairs'):
    validate_pairs(default_conf['exchange']['pair_whitelist'])
    assert ('freqtrade.exchange',
            logging.WARNING,
            'Unable to validate pairs (assuming they are correct). Reason: '
            ) in caplog.record_tuples