Ejemplo n.º 1
0
    def setUp(self):
        self.ctx = self.app.test_request_context()
        self.ctx.push()
        db.create_all()
        # Initial Setup
        random_user_id = uuid_b58()
        self.user = User(
            username='******'.format(userid=random_user_id.lower()),
            fullname="Luke Skywalker",
            email='luke{userid}@dagobah.org'.format(userid=random_user_id),
        )

        db.session.add(self.user)
        db.session.commit()

        self.organization = Organization(name='spacecon',
                                         title="SpaceCon",
                                         owner=self.user)
        db.session.add(self.organization)
        db.session.commit()
        self.profile = self.organization.profile

        self.project = Project(
            title="20000 AD",
            tagline="In a galaxy far far away...",
            profile=self.profile,
            user=self.user,
        )
        db.session.add(self.project)
        self.project.make_name()
        db.session.commit()

        self.ticket_client = TicketClient(
            name="test client",
            client_eventid='123',
            clientid='123',
            client_secret='123',
            client_access_token='123',
            project=self.project,
        )
        db.session.add(self.ticket_client)
        db.session.commit()

        bulk_upsert(self.project, event_ticket_types)
        db.session.commit()

        self.session = db.session
Ejemplo n.º 2
0
    def setUp(self):
        self.ctx = self.app.test_request_context()
        self.ctx.push()
        init_for('test')
        db.create_all()
        # Initial Setup
        random_user_id = random.randint(1, 1000)
        self.user = User(
            userid=unicode(random_user_id),
            username=u'lukes{userid}'.format(userid=random_user_id),
            fullname=u"Luke Skywalker",
            email=u'luke{userid}@dagobah.org'.format(userid=random_user_id))

        db.session.add(self.user)
        db.session.commit()

        self.profile = Profile(title='SpaceCon', userid=self.user.userid)
        db.session.add(self.profile)
        db.session.commit()

        self.space = ProposalSpace(title='20000 AD',
                                   tagline='In a galaxy far far away...',
                                   profile=self.profile,
                                   user=self.user)
        db.session.add(self.space)
        db.session.commit()

        self.ticket_client = TicketClient(name="test client",
                                          client_eventid='123',
                                          clientid='123',
                                          client_secret='123',
                                          client_access_token='123',
                                          proposal_space=self.space)
        db.session.add(self.ticket_client)
        db.session.commit()

        bulk_upsert(self.space, event_ticket_types)
        db.session.commit()

        self.session = db.session