Skip to content

Commit

Permalink
add coinmarketcap conversion test
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Mar 29, 2017
1 parent 5c2918a commit a4493b5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
21 changes: 21 additions & 0 deletions tests/reference/coinmarketcap/v1/currentprice/bitcoin/EUR.json
@@ -0,0 +1,21 @@
[
{
"id": "bitcoin",
"name": "Bitcoin",
"symbol": "BTC",
"rank": "1",
"price_usd": "1040.57",
"price_btc": "1.0",
"24h_volume_usd": "296801000.0",
"market_cap_usd": "16903031567.0",
"available_supply": "16244012.0",
"total_supply": "16244012.0",
"percent_change_1h": "-0.2",
"percent_change_24h": "-0.36",
"percent_change_7d": "0.36",
"last_updated": "1490827446",
"price_eur": "966.41690066",
"volume_eur": "275650367.138",
"market_cap_eur": "15698487731.0"
}
]
21 changes: 15 additions & 6 deletions tests/test_endpoint.py
Expand Up @@ -89,7 +89,15 @@ class BPITestCase(EndpointTest, TestCase):
timestamp = datetime(2017, 3, 16, 1, 25, tzinfo=tzutc())


class CoinmarketcapTestCase(EndpointTest, TestCase):
class BitstampTestCase(EndpointTest, TestCase):
endpointClass = bitstamp.Bitstamp
ref_json = 'bitstamp/v2/currentprice/bitcoin/USD.json'

price = 1103.2
timestamp = datetime(2017, 3, 17, 3, 45, 13, tzinfo=tzutc())


class CoinmarketcapUSDTestCase(EndpointTest, TestCase):
currency = 'USD'
endpointClass = coinmarketcap.Coinmarketcap
ref_json = 'coinmarketcap/v1/currentprice/bitcoin/USD.json'
Expand All @@ -98,9 +106,10 @@ class CoinmarketcapTestCase(EndpointTest, TestCase):
timestamp = datetime(2017, 3, 16, 0, 59, 26, tzinfo=tzutc())


class BitstampTestCase(EndpointTest, TestCase):
endpointClass = bitstamp.Bitstamp
ref_json = 'bitstamp/v2/currentprice/bitcoin/USD.json'
class CoinmarketcapConversionTestCase(CoinmarketcapUSDTestCase):
currency = 'EUR'
currency_country = 'Euro'
ref_json = 'coinmarketcap/v1/currentprice/bitcoin/EUR.json'

price = 1103.2
timestamp = datetime(2017, 3, 17, 3, 45, 13, tzinfo=tzutc())
price = 966.41690066
timestamp = datetime(2017, 3, 29, 22, 44, 6, tzinfo=tzutc())

0 comments on commit a4493b5

Please sign in to comment.