Пример #1
0
    def setUp(self):
        # Bug workarounds
        admin._views = []
        rest_api.resources = []

        app = create_app('blogapp.config.TestConfig')
        self.client = app.test_client()

        # Bug workaround
        db.app = app

        db.create_all()
Пример #2
0
    def setUp(self):
        # Bug workarounds
        admin._views = []
        rest_api.resources = []

        app = create_app('blogapp.config.TestConfig')
        self.client = app.test_client()

        # Bug workaround
        db.app = app

        db.create_all()
Пример #3
0
from blogapp import create_app
from blogapp.models import db, User, Role

app = create_app('blogapp.config.TestConfig')

db.app = app
db.create_all()

default = Role(name="default")
poster = Role(name="poster")
db.session.add(default)
db.session.add(poster)
db.session.commit()

test_user = User(username="******")
test_user.set_password("test")
test_user.roles.append(poster)
db.session.add(test_user)
db.session.commit()

app.run(port=5001, use_reloader=False)