def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'test.db')
     self.app = app.test_client()
     db.create_all()
     u = User('John', 'Smith', 'Vista', 'Admin', '*****@*****.**', 'test')
     db.session.add(u)
     db.session.commit()
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'test.db')
     self.app = app.test_client()
     db.create_all()
     u = User('John', 'Smith', 'Vista', 'Admin', '*****@*****.**', 'test')
     r1 = Record(user_id='1', training_name='Safety Overview',
                 date_time=datetime.strptime('2015-01-01', due_date_format))
     r2 = Record(user_id='1', training_name='Hazard Communication',
                 date_time=datetime.strptime('2014-06-15', due_date_format))
     r3 = Record(user_id='1', training_name='Controlled Chemical Substances',
                 date_time=datetime.strptime('2014-01-01', due_date_format))
     db.session.add(u)
     db.session.add(r1)
     db.session.add(r2)
     db.session.add(r3)
     db.session.commit()
     print "\n"
     print "*~" * 20
from safety_site import db
from safety_site.models import User, Record

db.create_all()


def create_users():
    user1 = User('Jun', 'Ninja', 'Vista', 'Administration', '*****@*****.**', 'password')
    user2 = User('Rosita', 'Samurai', 'Vista', 'Purification', '*****@*****.**', 'password')
    user3 = User('Juliana', 'Shaolin', 'Vista', 'Purification', '*****@*****.**', 'password')

    db.session.add(user1)
    db.session.add(user2)
    db.session.add(user3)

    db.session.commit()


def create_record():
    record1 = Record(1, 'Safety Overview', 'January', '2015', '10:00')
    record2 = Record(2, 'Safety Overview', 'January', '2015', '10:00')
    record3 = Record(3, 'Safety Overview', 'January', '2015', '10:00')
    record4 = Record(1, 'Handling Hazardous Materials and Waste', 'February', '2014', '10:00')
    record5 = Record(2, 'Handling Hazardous Materials and Waste', 'February', '2014', '10:00')
    record6 = Record(3, 'Handling Hazardous Materials and Waste', 'February', '2014', '10:00')
    record7 = Record(1, 'Hazard Communication', 'March', '2014', '10:00')
    record8 = Record(2, 'Hazard Communication', 'March', '2014', '10:00')
    record9 = Record(3, 'Hazard Communication', 'March', '2014', '10:00')

    db.session.add(record1)
    db.session.add(record2)