def import_tournament(type, path, bracket, region, name): config = Config() mongo_client = MongoClient(host=config.get_mongo_url()) if type == 'tio': scraper = TioScraper.from_file(path, bracket) elif type == 'challonge': scraper = ChallongeScraper(path) else: click.echo("Illegal type") dao = Dao(region, mongo_client=mongo_client) player_map = get_player_alias_to_id_map(scraper, dao) # TODO pass in a map of overrides for specific players tournament = Tournament.from_scraper(type, scraper, player_map, region) if name: tournament.name = name dao.insert_tournament(tournament) click.echo("Generating new ranking...") rankings.generate_ranking(dao) click.echo("Done!")
def test_get_matches_one_grand_finals_set(self): self.scraper = TioScraper.from_file('test/test_scraper/data/2.tio', BRACKET_NAME) matches = self.scraper.get_matches() self.assertEquals(len(matches), 116) self.assertEquals(matches[0], MatchResult(winner='spookyman', loser='razr')) # grand finals set 1 self.assertEquals(matches[-1], MatchResult(winner='GC|silent wolf', loser='MIOM|SFAT')) # losers finals self.assertEquals(matches[-2], MatchResult(winner='MIOM|SFAT', loser='shroomed'))
def test_get_matches_invalid_bracket_name(self): with self.assertRaises(ValueError): self.scraper = TioScraper.from_file(FILEPATH, 'invalid bracket name') self.scraper.get_matches()
def setUp(self): self.scraper = TioScraper.from_file(FILEPATH, BRACKET_NAME)