def setUp(self): db.session.commit() db.drop_all() db.create_all() self.user = User(email='*****@*****.**', password=crypt.generate_password_hash('9797ifdhvsd'), balance=10) db.session.add(self.user) db.session.commit()
def setUp(self): # this gets called before every test so there's always the same data for the program to test db.session.commit() db.drop_all() db.create_all() # this ensures that the databse is completely empty by destroying and rebuilding it hashed_pw = bcrypt.generate_password_hash("admin") admin = Users(first_name="admin", last_name="admin", email="*****@*****.**", password=hashed_pw) # creates the first (admin) test user hashed_pw_2 = bcrypt.generate_password_hash("password") avguser = Users(first_name="test", last_name="user", email="*****@*****.**", password=hashed_pw_2) # creates the second (non-admin) test user db.session.add(admin) db.session.add(avguser) db.session.commit()
def tearDown(self): db.session.remove() db.drop_all()
def tearDown(self): # this is called after every test so that the database doesn't get clogged with unneeded data # and to reset it to the default values, so one test can't effect another db.session.remove() db.drop_all()
#! /Users/jodth07/Env/dreamers/bin/python from Application import db # from .Application.dictionary.models import Dictionary # from .Application.user.models import User from Application.user.models import User from Application.dictionary.models import Dictionary from Application.blog.models import Blog from Application.article.models import Article from datetime import datetime defined_user_id = 1001 Sous = 'Plant ak Pyebwa tè d Ayiti' db.drop_all() # def setup_db(): # create the database and the database table db.create_all() Non= "Arawout" Lot_Non= "Mazonbèl" Tip= "Plant" Fanmi= "Marantaceae" Non_Syantifik= "Maranta arundinacea L" Orijin= "Plant sa a sòti an Amerik-di-Sid. Ou kapab jwenn li tou nan anpil lòt rejyon twopikal tankou zile Awayi yo, " \ "Afrik-di-Sid, Azi, ak Ostrali." Deskripsyon= "Arawout se yon plant vivas. Genyen 2 kalite ladan l. Youn genyen yon rizòm ki long, lòt la yon rizòm " \ "ki kout. Rizòm sa yo toujou an fòm yon flèch ki kouvri ak yon bann ti kal an fòm triyang. Plant sa a " \ "kapab fleri pandan plizyè ane youn dèyè lòt. Pati tij la ki anwo tè a pa twò di. Li kapab rive jiska 2 "\ "mèt wotè lè fin grandi." Fey= "Fèy li yo gen yon koule vèt fonse avèk yon fòm alonje."