Skip to content

Commit

Permalink
Add missing test for CryptoToFiatConverter::convert_amount()
Browse files Browse the repository at this point in the history
  • Loading branch information
glonlas committed Jun 8, 2018
1 parent 81ce7d7 commit dfbc94c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion freqtrade/tests/test_fiat_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def test_fiat_init_network_exception(mocker):
fiat_convert._cryptomap = {}
fiat_convert._load_cryptomap()

assert len(fiat_convert._cryptomap) == 0
length_cryptomap = len(fiat_convert._cryptomap)
assert length_cryptomap == 0


def test_fiat_convert_without_network():
Expand All @@ -175,3 +176,22 @@ def test_fiat_convert_without_network():
assert fiat_convert._coinmarketcap is None
assert fiat_convert._find_price(crypto_symbol='BTC', fiat_symbol='USD') == 0.0
CryptoToFiatConverter._coinmarketcap = cmc_temp


def test_convert_amount(mocker):
mocker.patch('freqtrade.fiat_convert.CryptoToFiatConverter.get_price', return_value=12345.0)

fiat_convert = CryptoToFiatConverter()
result = fiat_convert.convert_amount(
crypto_amount=1.23,
crypto_symbol="BTC",
fiat_symbol="USD"
)
assert result == 15184.35

result = fiat_convert.convert_amount(
crypto_amount=1.23,
crypto_symbol="BTC",
fiat_symbol="BTC"
)
assert result == 1.23

0 comments on commit dfbc94c

Please sign in to comment.