Exemplo n.º 1
0
    def test_print_stats(self):
        config = create_core_test_config()
        api_wrapper = create_mock_api_wrapper(config)
        event_manager = Mock()
        logger = Mock()
        logger.log = Mock()
        player_service = Player(api_wrapper, event_manager, logger)

        pgo = api_wrapper.get_api()
        pgo.set_response('get_player', self._create_generic_player_response())
        pgo.set_response('get_inventory', self._create_generic_inventory_response())

        logger.log.return_value = None

        player_service.print_stats()

        assert logger.log.call_count == 15
        self._assert_log_call(logger.log, 'Username: test_account')
        self._assert_log_call(logger.log, 'Bag storage: 36/350')
        self._assert_log_call(logger.log, 'Pokemon storage: 2/250')
        self._assert_log_call(logger.log, 'Stardust: 20,000')
        self._assert_log_call(logger.log, 'Pokecoins: 10')
        self._assert_log_call(logger.log, 'Poke Balls: 11')
        self._assert_log_call(logger.log, 'Great Balls: 12')
        self._assert_log_call(logger.log, 'Ultra Balls: 13')
        self._assert_log_call(logger.log, '-- Level: 14')
        self._assert_log_call(logger.log, '-- Experience: 15')
        self._assert_log_call(logger.log, '-- Experience until next level: 985')
        self._assert_log_call(logger.log, '-- Pokemon captured: 17')
        self._assert_log_call(logger.log, '-- Pokestops visited: 18')

        assert pgo.call_stack_size() == 0
Exemplo n.º 2
0
    def test_print_stats_no_update(self):
        config = create_core_test_config()
        api_wrapper = create_mock_api_wrapper(config)
        event_manager = Mock()
        logger = Mock()
        logger.log = Mock()
        player_service = Player(api_wrapper, event_manager, logger)

        api_wrapper.call = Mock(return_value=None)

        logger.log.return_value = None

        player_service.print_stats()

        self._assert_log_call(logger.log, 'Failed to retrieve player and inventory stats', color='red')