def setUp(self): app = create_app('testting') self.app_context = app.test_request_context() self.app_context.push() db.create_all() slef.client = app.test_client() user = User(username='******') user.set_password('123') db.session.add(user) db.session.commit()
def setUp(self): app = create_app('testing') self.app_context = app.test_request_context() self.app_context.push() db.create_all() self.client = app.test_client() user = User(username='******') user.set_password('123') item = Item(body='Test Item', author=user) user2 = User(username='******') user2.set_password('123') item2 = Item(body='Test Item 2', author=user2) db.session.add_all([user, item, user2, item2]) db.session.commit()
def setUp(self): app = create_app('testing') self.app_context = app.test_request_context() self.app_context.push() self.client = app.test_client() user = User(username='******') user.set_password('123') item1 = Item(body='Item 1', author=user) item2 = Item(body='Item 2', author=user) item3 = Item(body='Item 3', author=user) user2 = User(username='******') user2.set_password('123') item = Item(body='Item', author=user2) db.session.add_all(user, item1, item2, item3, user2, item) db.session.commit() self.client.post(url_for('auth.login'), json=dict(username='******', password='******'))
def setUp(self): app = create_app('testing') self.app_context = app.test_request_context() self.app_context.push() db.create_all() self.client = app.test_client() user = User(username='******') user.set_password('123') item1 = Item(body='Item 1', author=user) item2 = Item(body='Item 2', author=user) item3 = Item(body='Item 3', author=user) user2 = User(username='******') user2.set_password('456') item = Item(body='Item', author=user2) db.session.add(user) db.session.add(user2) db.session.commit() # Log the test user in self.client.post(url_for('auth.login'), json=dict(username='******', password='******'))
def setUp(self): app = create_app('testing') self.app_context = app.test_request_context() self.app_context.push() db.create_all() self.client = app.test_client()
from todoism import create_app if __name__ == '__main__': app = create_app() # print(app.config) app.run()
def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.create_all()
# -*- coding: utf-8 -*- """ :author: Grey Li (李辉) :url: http://greyli.com :copyright: © 2018 Grey Li <*****@*****.**> :license: MIT, see LICENSE for more details. """ from todoism import create_app, db from todoism.models import User, Item app = create_app('testing') with app.app_context(): db.create_all() user = User(username='******') user.set_password('123') db.session.add(user) item1 = Item(body='test item 1') item2 = Item(body='test item 2') item3 = Item(body='test item 3') item4 = Item(body='test item 4', done=True) user.items = [item1, item2, item3, item4] db.session.commit()
import os from dotenv import load_dotenv dotenv_path = os.path.join(os.path.dirname(__file__), '.env') if os.path.exists(dotenv_path): load_dotenv(dotenv_path) from todoism import create_app # noqa app = create_app('production')
import os from todoism import create_app import pymysql pymysql.install_as_MySQLdb() config_name = os.getenv('FLASK_CONFIG', 'development') app = create_app(config_name) if __name__ == '__main__': app.run(debug=True)