Beispiel #1
0
def initdb():
    """Init/reset database."""

    db.drop_all()
    db.create_all()

    admin = User(
            name=u'admin',
            email=u'*****@*****.**',
            paypal=u'*****@*****.**',
            password=u'123456',
            role_code=ADMIN,
            status_code=ACTIVE,
            user_detail=UserDetail(
                first_name=u'Happy',
                middle_name=u'',
                last_name=u'Admin',
                sex_code=SEX_TYPE.MALE,
                date_of_birth=datetime.datetime.now() - datetime.timedelta(weeks=520),
                url=u'http://admin.example.com',
                location=u"Admin's hut",
                bio=u'A happy admin guy'))
    db.session.add(admin)
    db.session.commit()
Beispiel #2
0
    def tearDown(self):
        """Clean db session and drop all tables."""

        db.drop_all()