Ejemplo n.º 1
0
def client():
    BASE_DIR = Path(__file__).resolve().parent.parent
    app.config["TESTING"] = True
    app.config["DATABASE"] = BASE_DIR.joinpath(TEST_DB)
    app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{BASE_DIR.joinpath(TEST_DB)}"

    db.create_all()  # setup
    yield app.test_client()  # tests run here
    db.drop_all()  # teardown
Ejemplo n.º 2
0
 def setUp(self):
     db.create_all()
     breed = Breed(name='test')
     dog = Dog(name='test')
     user = User(username='******', email='*****@*****.**')
     user.set_password('test')
     db.session.add(breed)
     db.session.add(dog)
     db.session.add(user)
     db.session.commit()
Ejemplo n.º 3
0
def recreatedb():
    db.drop_all()
    db.create_all()
    db.session.commit()
Ejemplo n.º 4
0
# create_db.py

from project.app import db

# create the database and the db table
db.create_all()

# commit the changes
db.session.commit()
Ejemplo n.º 5
0
def initdb():
    db.create_all()
Ejemplo n.º 6
0
def create_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
    print('Database created!')
Ejemplo n.º 7
0
 def setup(self):
     db.create_all()
     db.session.commit()