def test_get_all_when_not_loaded_returns_empty_dict(self): # Arrange mock_client = MagicMock() mock_client.name = "Binance" provider = BinanceInstrumentProvider(client=mock_client) # Act instruments = provider.get_all() # Assert self.assertTrue(len(instruments) == 0)
def test_get_all_when_loaded_returns_instruments(self): # Arrange mock_client = MagicMock() mock_client.name = "Binance" with open(TEST_PATH + "res_instruments.json") as response: instruments = json.load(response) mock_client.markets = instruments provider = BinanceInstrumentProvider(client=mock_client) provider.load_all() # Act instruments = provider.get_all() # Assert self.assertTrue(len(instruments) > 0) self.assertEqual(dict, type(instruments)) self.assertEqual(Symbol, type(next(iter(instruments))))