def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.drop_all() db.create_all() user = User(username=self.default_username, password=self.default_password) user2 = User(username=self.another_user, password=self.default_password) db.session.add_all([user, user2]) db.session.commit() g.user = user bucketlist = BucketList(name=self.bucketlist_name, creator_id=user.id) bucketlist2 = BucketList(name=self.bucketlist2_name, creator_id=user2.id) bucketlist3 = BucketList(name=self.bucketlist3_name, creator_id=user.id) db.session.add_all([bucketlist, bucketlist2, bucketlist3]) db.session.commit() bucketlist_item = BucketListItem( name=self.bucketlist_item_name, bucketlist_id=bucketlist.id ) bucketlist_item2 = BucketListItem( name=self.bucketlist_item2_name, bucketlist_id=bucketlist2.id ) bucketlist_item3 = BucketListItem( name=self.bucketlist_item3_name, bucketlist_id=bucketlist3.id ) db.session.add_all([bucketlist_item, bucketlist_item2, bucketlist_item3]) db.session.commit() self.client = self.app.test_client()
def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_context.push() db.drop_all() db.create_all() user = User(username=self.default_username, password=self.default_password) db.session.add(user) db.session.commit() self.client = self.app.test_client()
def tearDown(self): db.session.remove() db.drop_all()
def tearDown(self): with self.app.app_context(): db.drop_all()
def tearDown(self): db.session.remove() db.drop_all() self.app_context.pop()
def _db(app): db.app = app db.create_all() yield db db.drop_all()