Exemple #1
0
 def test_parsing_with_one_coin(self, check_global_timed_game,
                                check_price_alerts_mock, mock_ticker,
                                mock_coin):
     mock_coin.get.return_value = Coin(symbol='FOO', name='Foocoin')
     ping('FOO')
     mock_ticker.create.assert_called_with(
         coin=mock_coin.get.return_value,
         price=Decimal('56.12345678'),
         price_change_day_pct=Decimal('-1.23456789'),
     )
Exemple #2
0
 def test_parsing_with_many_coins(self, check_global_timed_game,
                                  check_price_alerts_mock, mock_ticker,
                                  mock_coin):
     side_effect = [
         Coin(symbol='FOO', name='Foocoin'),
         Coin(symbol='BAR', name='Barcoin'),
     ]
     mock_coin.get.side_effect = side_effect
     ping('FOO', 'BAR')
     calls = [
         call(
             coin=side_effect[0],
             price=Decimal('56.12345678'),
             price_change_day_pct=Decimal('-1.23456789'),
         ),
         call(
             coin=side_effect[1],
             price=Decimal('42.98765432'),
             price_change_day_pct=Decimal('-1.23456789'),
         ),
     ]
     mock_ticker.create.assert_has_calls(calls, any_order=False)