Exemplo n.º 1
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Exemplo n.º 2
0
from users import db as users_db
# Models
from bookings import Booking
from movies import Movie
from rewards import Reward
from showtimes import Showtime
from users import User
# 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)
Exemplo n.º 3
0
def recreate_db():
    """Recreates a database."""
    db.drop_all()
    db.create_all()
    db.session.commit()
Exemplo n.º 4
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
     self.app_context.pop()