Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    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='******'))
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
0
# -*- 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()