def setUp(self): super(SetupBareInitTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) db_util.load_machines_from_json(self.flask_app, False)
def setUp(self): super(SetupTokenTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) db_util.load_machines_from_json(self.flask_app, True) stripe_skus = { 'A': 'sku_8bY4j0VdBxGmPu', 'B': 'sku_8bU4ZwvW1UMtxy', 'C': 'sku_8beFqmlhh0y6Wa', 'D': 'sku_8beJOPdNmnoQgw', 'Split Flipper': 'sku_8cVf2tetzJ4f8D', 'Classics 1': 'sku_8beHMnaBSdH4NA', 'Classics 2': 'sku_9jugzXV5S8oafx', 'Classics 3': 'sku_9juhywxXYAFfW7', 'Classics Meta': 'sku_9wukf1rcx9hWsb' } discount_stripe_skus = { 'A': 'sku_9wugGsS0eFracR', 'B': 'sku_9wuhUNp2629DGp', 'C': 'sku_9wuigiEVZ61TBJ', 'Split Flipper': 'sku_9wvPotSYBuA13h', 'Classics Meta': 'sku_9wtQxO4yXCGV9w' } discount_ticket_counts = { 'A': 3, 'B': 3, 'C': 3, 'Split Flipper': 3, 'Classics Meta': 3 } orm_creation.init_papa_tournaments_divisions( self.flask_app, True, stripe_skus=stripe_skus, discount_stripe_skus=discount_stripe_skus, discount_ticket_counts=discount_ticket_counts) orm_creation.init_papa_tournaments_division_machines(self.flask_app) #self.player = orm_creation.create_player(self.flask_app,{'first_name':'test','last_name':'player','ifpa_ranking':'123','linked_division_id':'1'}) #self.player_pin = self.player.pin orm_creation.init_papa_players(self.flask_app) orm_creation.create_team(self.flask_app, { 'team_name': 'test_team_1', 'players': [1, 2] }) orm_creation.create_team(self.flask_app, { 'team_name': 'test_team_2', 'players': [3, 4] }) orm_creation.create_team(self.flask_app, { 'team_name': 'test_team_3', 'players': [5, 6] })
def setUp(self): super(RouteFinalsTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) #FIXME : password/username should be passed in to create_roles_and_users() self.score_user_name_password = '******' self.admin_user_name_password = '******' db_util.load_machines_from_json(self.flask_app, True) orm_creation.init_papa_tournaments_divisions(self.flask_app) self.machine = self.flask_app.tables.Machine.query.filter_by( machine_id=1).first() self.division_machines = [] self.team_division_machines = [] self.players = [] self.teams = [] self.flask_app.tables.db_handle.session.commit() for i in range(100, 140): self.players.append( orm_creation.create_player( self.flask_app, { 'first_name': 'test', 'last_name': 'player%s' % i, 'ifpa_ranking': '123', 'linked_division_id': '1' })) for i in range(100, 110): for division in self.flask_app.tables.Division.query.filter_by( team_tournament=False).all(): self.division_machines.append( orm_creation.create_division_machine( self.flask_app, self.machine, division)) for division in self.flask_app.tables.Division.query.filter_by( team_tournament=True).all(): self.team_division_machines.append( orm_creation.create_division_machine( self.flask_app, self.machine, division)) self.division = self.flask_app.tables.Division.query.filter_by( team_tournament=False).all()[0] self.team_division = self.flask_app.tables.Division.query.filter_by( team_tournament=True).all()[0] for i in range(100, 110, 2): self.teams.append( orm_creation.create_team( self.flask_app, { 'team_name': 'test_team_%s' % i, 'players': ['%s' % i, '%s' % (i + 1)] }))
def setUp(self): super(RouteAuditLogTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) #FIXME : password/username should be passed in to create_roles_and_users() self.score_user_name_password = '******' self.admin_user_name_password = '******' db_util.load_machines_from_json(self.flask_app, True) orm_creation.init_papa_tournaments_divisions(self.flask_app) self.player = orm_creation.create_player( self.flask_app, { 'first_name': 'test', 'last_name': 'player', 'ifpa_ranking': '123', 'linked_division_id': '1' }) self.player_pin = self.player.pin self.player_two = orm_creation.create_player( self.flask_app, { 'first_name': 'test', 'last_name': 'player_2', 'ifpa_ranking': '123', 'linked_division_id': '1' }) self.machine = self.flask_app.tables.Machine.query.filter_by( machine_id=1).first() self.division = self.flask_app.tables.Division.query.filter_by( division_id=1).first() self.team_division = self.flask_app.tables.Division.query.filter_by( team_tournament=True).first() self.division_machine = orm_creation.create_division_machine( self.flask_app, self.machine, self.division) self.division_machines = [] machine_id = 1 for division in self.flask_app.tables.Division.query.all(): machine_id = machine_id + 1 self.new_machine = self.flask_app.tables.Machine.query.filter_by( machine_id=machine_id).first() self.division_machines.append( orm_creation.create_division_machine(self.flask_app, self.new_machine, division)) self.team_division_machine = orm_creation.create_division_machine( self.flask_app, self.machine, self.team_division)
def route_meta_admin_create_db_and_tournaments(init_players): dummy_app = Flask('dummy_app') db_config = td_config.get_db_config() db_info = DbInfo(db_config) db_util.create_db_and_tables(dummy_app, 'test', db_info , drop_tables=True) db_handle = dummy_app.tables.db_handle create_stanard_roles_and_users(dummy_app) db_util.load_machines_from_json(dummy_app) orm_creation.init_papa_tournaments_divisions(dummy_app) orm_creation.init_papa_tournaments_division_machines(dummy_app) if init_players == 1: orm_creation.init_papa_players(dummy_app,short=True,number_of_a_players=200) db_handle.engine.dispose() del dummy_app return jsonify({'data':'test'})
def setUp(self): super(RouteQueueTD,self).setUp() response,results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user,self.desk_user = orm_creation.create_stanard_roles_and_users(self.flask_app) #FIXME : password/username should be passed in to create_roles_and_users() self.score_user_name_password='******' db_util.load_machines_from_json(self.flask_app,True) orm_creation.init_papa_tournaments_divisions(self.flask_app) self.player = orm_creation.create_player(self.flask_app,{'first_name':'test','last_name':'player','ifpa_ranking':'123','linked_division_id':'1'}) self.player_two = orm_creation.create_player(self.flask_app,{'first_name':'test_two','last_name':'player_two','ifpa_ranking':'321','linked_division_id':'1'}) self.player_three = orm_creation.create_player(self.flask_app,{'first_name':'test_three','last_name':'player_three','ifpa_ranking':'444','linked_division_id':'1'}) self.player_four = orm_creation.create_player(self.flask_app,{'first_name':'test_three','last_name':'player_four','ifpa_ranking':'555','linked_division_id':'1'}) self.machine = self.flask_app.tables.Machine.query.filter_by(machine_id=1).first() self.division = self.flask_app.tables.Division.query.filter_by(division_id=1).first() self.division_machine = orm_creation.create_division_machine(self.flask_app,self.machine,self.division) self.division_machine_2 = orm_creation.create_division_machine(self.flask_app,self.machine,self.division)
def setUp(self): super(RouteStripeTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) db_util.load_machines_from_json(self.flask_app, True) #FIXME : This should be passed in from env variables? orm_creation.init_papa_tournaments_divisions( self.flask_app, use_stripe=True, stripe_sku=[ "sku_8bY4j0VdBxGmPu", "sku_8zGvY92kgyMlx1", "sku_8cVf2tetzJ4f8D", "sku_8beHMnaBSdH4NA", "sku_8beJOPdNmnoQgw", "sku_8beFqmlhh0y6Wa", "sku_8bU4ZwvW1UMtxy", "sku_9jugzXV5S8oafx", "sku_9juhywxXYAFfW7" ]) self.player = orm_creation.create_player( self.flask_app, { 'first_name': 'test', 'last_name': 'player', 'ifpa_ranking': '123', 'linked_division_id': '1' }) self.player_pin = self.player.pin self.player_two = orm_creation.create_player( self.flask_app, { 'first_name': 'test_two', 'last_name': 'player_two', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_team(self.flask_app, { 'team_name': 'test_team', 'players': ['1', '2'] })
def setUp(self): super(RouteTokenTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) db_util.load_machines_from_json(self.flask_app, True) orm_creation.init_papa_tournaments_divisions(self.flask_app) self.player = orm_creation.create_player( self.flask_app, { 'first_name': 'test', 'last_name': 'player', 'ifpa_ranking': '123', 'linked_division_id': '1' }) self.player_id = self.player.player_id self.player_pin = self.player.pin self.player_two = orm_creation.create_player( self.flask_app, { 'first_name': 'test_two', 'last_name': 'player_two', 'ifpa_ranking': '321', 'linked_division_id': '1' }) self.player_two_id = self.player_two.player_id self.team = orm_creation.create_team( self.flask_app, { 'team_name': 'test_team', 'players': [str(self.player.player_id), str(self.player_two.player_id)] }) self.team_id = self.team.team_id
def setUp(self): super(SetupAddToMachineTD, self).setUp() response, results = self.dispatch_request('/%s/util/healthcheck' % self.poop_db_name) self.flask_app = self.app.instances[self.poop_db_name] self.admin_user, self.scorekeeper_user, self.desk_user = orm_creation.create_stanard_roles_and_users( self.flask_app) db_util.load_machines_from_json(self.flask_app, False) stripe_skus = { 'A': 'main_a_1', 'B': 'main_b_1', 'C': 'main_c_1', 'D': 'main_d_1', 'Split Flipper': 'split_1', 'Classics 1': 'classics_1', 'Classics 2': 'classics_1', 'Classics 3': 'classics_1', 'Classics Meta': 'classics_1' } discount_stripe_skus = { 'A': 'main_a_3', 'B': 'main_b_3', 'C': 'main_c_3', 'Split Flipper': 'split_3', 'Classics Meta': 'classics_3' } discount_ticket_counts = { 'A': 3, 'B': 3, 'C': 3, 'Split Flipper': 3, 'Classics Meta': 3 } orm_creation.init_papa_tournaments_divisions( self.flask_app, True, stripe_skus=stripe_skus, discount_stripe_skus=discount_stripe_skus, discount_ticket_counts=discount_ticket_counts) orm_creation.init_papa_tournaments_division_machines(self.flask_app) orm_creation.init_papa_players(self.flask_app) orm_creation.create_player( self.flask_app, { 'first_name': 'Doug', 'last_name': 'Polka', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Al', 'last_name': 'Thomka', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Elizabeth', 'last_name': 'Cromwell', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Greg', 'last_name': 'Galanter', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Josh', 'last_name': 'Sharpe', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Mark', 'last_name': 'Steinman', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Amy', 'last_name': 'Covell', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'AJ', 'last_name': 'Repolgle', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Fred', 'last_name': 'Cochran', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Aiton', 'last_name': 'Goldman', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Cassie', 'last_name': 'Stahl', 'ifpa_ranking': '321', 'linked_division_id': '1' }) orm_creation.create_player( self.flask_app, { 'first_name': 'Jon', 'last_name': 'Replgle', 'ifpa_ranking': '321', 'linked_division_id': '1' })
def test_load_machines(): # check if the post request has the file part db_util.load_machines_from_json(current_app, False) return jsonify({})