def test_set_rounds(self): """change the number of rounds in a tournament""" name = 'test_set_rounds' self.injector.inject(name) tourn = Tournament(name) tourn._set_rounds(6) self.assertTrue(tourn.details()['rounds'] == 6) tourn._set_rounds(2) self.assertTrue(tourn.details()['rounds'] == 2)
def add_tournament(): # pylint: disable=undefined-variable """ POST to add a tournament Expects: - inputTournamentName - Tournament name. Must be unique. - inputTournamentDate - Tournament Date. YYYY-MM-DD """ opt_args = request.get_json() if request.get_json() is not None else {} tourn = Tournament(inputTournamentName) tourn.new(date=inputTournamentDate, to_username=request.authorization.username, **opt_args) return tourn.details()