24 lines
724 B
Python
24 lines
724 B
Python
|
from unittest import TestCase
|
||
|
from unittest.mock import MagicMock
|
||
|
|
||
|
from tests.common import fake_public_ads, currency_map, cg_prices
|
||
|
from agora import Agora
|
||
|
|
||
|
|
||
|
class TestAgora(TestCase):
|
||
|
def setUp(self):
|
||
|
self.agora = Agora()
|
||
|
|
||
|
def mock_wrap_public_ads(self, asset, currency, providers, rates):
|
||
|
try:
|
||
|
return currency_map[currency]
|
||
|
except KeyError:
|
||
|
return
|
||
|
|
||
|
def test_get_all_public_ads(self):
|
||
|
self.agora.cg.get_price = MagicMock()
|
||
|
self.agora.cg.get_price.return_value = cg_prices
|
||
|
self.agora.wrap_public_ads = self.mock_wrap_public_ads
|
||
|
public_ads = self.agora.get_all_public_ads()
|
||
|
self.assertDictEqual(public_ads, fake_public_ads)
|