def setUp(self):
        super(RouteDivisionMachineTD, 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)
        self.admin_user_password = '******'
        self.desk_user_password = '******'
        self.machine = self.flask_app.tables.Machine(
            machine_name='test_machine', abbreviation='AAAA')
        self.machine_2 = self.flask_app.tables.Machine(
            machine_name='test_machine_2', abbreviation='BBBB')
        self.flask_app.tables.db_handle.session.add(self.machine)
        self.flask_app.tables.db_handle.session.add(self.machine_2)
        self.flask_app.tables.db_handle.session.commit()
        self.new_tournament = orm_creation.create_tournament(
            self.flask_app, {
                'tournament_name': 'test_tournament_1',
                'single_division': True,
                'finals_num_qualifiers': '24',
                'scoring_type': "HERB",
                'team_tournament': False,
                'local_price': '5',
                'use_stripe': False
            })
        self.new_team_tournament = orm_creation.create_tournament(
            self.flask_app, {
                'tournament_name': 'test_tournament_2',
                'single_division': True,
                'finals_num_qualifiers': '24',
                'scoring_type': "HERB",
                'team_tournament': True,
                'local_price': '5',
                'use_stripe': False
            })

        self.new_player = orm_creation.create_player(self.flask_app, {
            'first_name': 'test',
            'last_name': 'player',
            'ifpa_ranking': '123'
        })
        self.new_player_pin = self.new_player.pin
        self.new_player_2 = orm_creation.create_player(self.flask_app, {
            'first_name': 'test',
            'last_name': 'player_2',
            'ifpa_ranking': '123'
        })
        self.new_team = orm_creation.create_team(self.flask_app, {
            'team_name': 'test_team',
            'players': ['1', '2']
        })
        self.new_team_2 = orm_creation.create_team(self.flask_app, {
            'team_name': 'test_team_2',
            'players': ['1', '2']
        })
    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)]
                    }))
예제 #3
0
    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']
        })
예제 #4
0
    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(RouteEntryTD, 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.team_division_machine = orm_creation.create_division_machine(
            self.flask_app, self.machine, self.team_division)

        self.new_team = orm_creation.create_team(self.flask_app, {
            'team_name': 'test_team',
            'players': ['1', '2']
        })
    def test_get_player_on_team(self):
        self.new_player = orm_creation.create_player(self.flask_app, {
            'first_name': 'aiton',
            'last_name': 'goldman',
            'ifpa_ranking': '123'
        })
        self.new_team = orm_creation.create_team(self.flask_app, {
            'team_name': 'test_team',
            'players': ['1']
        })

        with self.flask_app.test_client() as c:
            rv = c.get('/player/1')
            self.assertEquals(
                rv.status_code, 200,
                'Was expecting status code 200, but it was %s : %s' %
                (rv.status_code, rv.data))
            returned_player = json.loads(rv.data)['data']

            self.assertEquals(returned_player['teams'][0]['team_name'],
                              'test_team')
예제 #7
0
    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