コード例 #1
0
def users():
    if UserModel.table_exists():
        UserModel.truncate_table(cascade=True)

    UserModel.create_table()

    salt = os.urandom(32)
    users = [
        UserModel.create(
            username="******",
            email_address="*****@*****.**",
            key=get_hash(password="******", salt=salt),
            salt=salt,
            role=UserRole.ADMIN,
        ),
        UserModel.create(
            username="******",
            email_address="*****@*****.**",
            key=get_hash(password="******", salt=salt),
            salt=salt,
            role=UserRole.ADMIN,
        ),
        UserModel.create(
            username="******",
            email_address="*****@*****.**",
            key=get_hash(password="******", salt=salt),
            salt=salt,
        ),
        UserModel.create(
            username="******",
            email_address="*****@*****.**",
            key=get_hash(password="******", salt=salt),
            salt=salt,
        ),
    ]
    yield users

    UserModel.truncate_table(cascade=True)
コード例 #2
0
ファイル: seeds.py プロジェクト: mickorivera/irithm-cards
def clear_table():
    UserModel.truncate_table(cascade=True)