Пример #1
0
    def test_poll_market_catalogue_error(self, mock_events):
        mock_context = mock.Mock()
        mock_flumine = mock.Mock()
        mock_client = mock.Mock()
        mock_flumine.clients.get_betfair_default.return_value = mock_client
        mock_market_one = mock.Mock(market_id="1.234",
                                    update_market_catalogue=True,
                                    closed=False)
        mock_flumine.markets.markets = {
            "1.234": mock_market_one,
        }
        mock_client.betting_client.betting.list_market_catalogue.side_effect = (
            BetfairError())

        worker.poll_market_catalogue(mock_context, mock_flumine)
        mock_client.betting_client.betting.list_market_catalogue.assert_called_with(
            filter={"marketIds": ["1.234"]},
            market_projection=[
                "COMPETITION",
                "EVENT",
                "EVENT_TYPE",
                "RUNNER_DESCRIPTION",
                "RUNNER_METADATA",
                "MARKET_START_TIME",
                "MARKET_DESCRIPTION",
            ],
            max_results=25,
        )
        mock_flumine.handler_queue.put.assert_not_called()
Пример #2
0
    def test_poll_market_catalogue(self, mock_events):
        mock_context = mock.Mock()
        mock_flumine = mock.Mock()
        mock_market_one = mock.Mock(market_id="1.234",
                                    update_market_catalogue=True)
        mock_market_two = mock.Mock(market_id="5.678",
                                    update_market_catalogue=False)
        mock_flumine.markets.markets = {
            "1.234": mock_market_one,
            "5.678": mock_market_two,
        }

        worker.poll_market_catalogue(mock_context, mock_flumine)
        mock_flumine.client.betting_client.betting.list_market_catalogue.assert_called_with(
            filter={"marketIds": ["1.234"]},
            market_projection=[
                "COMPETITION",
                "EVENT",
                "EVENT_TYPE",
                "RUNNER_DESCRIPTION",
                "RUNNER_METADATA",
                "MARKET_START_TIME",
                "MARKET_DESCRIPTION",
            ],
            max_results=25,
        )
        mock_flumine.handler_queue.put.assert_called_with(
            mock_events.MarketCatalogueEvent())