Skip to content

Commit 4a6f7ac

Browse files
committed
Added test_24h_price_change.py
1 parent 14fadbc commit 4a6f7ac

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Test24hPriceChange:
2+
3+
def test_response_corresponds_swagger_schema(self, client):
4+
resp_keys = [
5+
'symbol', 'priceChange', 'priceChangePercent',
6+
'weightedAvgPrice', 'prevClosePrice', 'lastPrice',
7+
'lastQty', 'bidPrice', 'askPrice',
8+
'openPrice', 'highPrice', 'lowPrice',
9+
'volume', 'quoteVolume', 'openTime', 'closeTime'
10+
]
11+
price_changes = client.get_24h_price_change('GBP/USD_LEVERAGE')
12+
assert type(price_changes) is dict
13+
assert len(price_changes) > 0
14+
assert all(dct in resp_keys for dct in price_changes.keys())
15+
assert all(price_changes[key] is not None for key in
16+
price_changes.keys())
17+
18+
def test_wrong_symbol(self, client):
19+
price_changes = client.get_24h_price_change(symbol="TEST123")
20+
assert price_changes['code'] == -1128 and 'symbol not found ' \
21+
in price_changes['msg']

0 commit comments

Comments
 (0)