def create_test_user(): app = CreateApp.Test() from caten_music import models models.db.create_all() # 建立已經啟動的帳號 test_user = models.User(username="******", email="*****@*****.**", displayname="testDisplay", password="******", is_authenticated=True, is_active=True) test_user.save() # 建立尚未啟動的帳號 test_user_not_activated = models.User( username="******", email="*****@*****.**", displayname="testDisplay", password="******") test_user_not_activated.save()
def dropAll(): app = CreateApp.Test() from caten_music.models.base import db db.drop_all()
def createAll(): app = CreateApp.Test() from caten_music.models.base import db db.create_all()
def client(): app = CreateApp.Test() # db_fd, app.config["SQLALCHEMY_DATABASE_URI"] = tempfile.mkstemp() client = app.test_client() yield client