def test_lbry_btc_feed_response(self): feed = LBRYBTCFeed() out = feed.get_rate_from_response({ 'data': { 'fresh': 0, 'lbc_usd': 0.05863062523378918, 'lbc_btc': 5.065289549855739e-05, 'btc_usd': 1157.498 }, 'success': True, 'error': None }) self.assertEqual(1.0 / 1157.498, out) with self.assertRaises(InvalidExchangeRateResponseError): feed.get_rate_from_response({}) with self.assertRaises(InvalidExchangeRateResponseError): feed.get_rate_from_response({"success": True, "result": {}})
def get_fake_exchange_rate_manager(rates=None): return FakeExchangeRateManager([LBRYFeed(), LBRYBTCFeed()], rates or { 'BTCLBC': 3.0, 'USDBTC': 2.0 })