Ejemplo n.º 1
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     self.client = self.app.test_client()
     db.create_all()
     Permission.create_permissions()
Ejemplo n.º 2
0
 def setUp(self):
     db.create_all()
     db.session.commit()
Ejemplo n.º 3
0
from users import db
db.create_all()
Ejemplo n.º 4
0
def recreate_db():
    """Recreates a database."""
    db.drop_all()
    db.create_all()
    db.session.commit()
Ejemplo n.º 5
0
# timestamp
from datetime import date

# Clean previous databses
bookings_db.drop_all()
movies_db.drop_all()
rewards_db.drop_all()
showtimes_db.drop_all()
users_db.drop_all()

# Create the databases
bookings_db.create_all()
movies_db.create_all()
rewards_db.create_all()
showtimes_db.create_all()
users_db.create_all()

# populate bookings
b1 = Booking(user=1, date=date(2019, 11, 1), movie=1)
b2 = Booking(user=2, date=date(2019, 11, 2), movie=2)
b3 = Booking(user=3, date=date(2019, 11, 3), movie=3)
bookings_db.session.add(b1)
bookings_db.session.add(b2)
bookings_db.session.add(b3)
bookings_db.session.commit()

# populate movies
m1 = Movie(rating=10, title="Boyhood", director="Richard Linklater")
m2 = Movie(rating=8, title="Before Sunset", director="Richard Linklater")
m3 = Movie(rating=9, title="Waking Life", director="Richard Linklater")
movies_db.session.add(m1)