コード例 #1
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['WTF_CSRF_ENABLED'] = False
     app.config['DEBUG'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///testdatabase.db'
     self.app = app.test_client()
     db.drop_all()
     db.create_all()
コード例 #2
0
ファイル: db_utils.py プロジェクト: rioscesar/Plunjr-API
def recreate_db():
    try:
        db.reflect()
        db.drop_all()
    except SQLAlchemyError as e:
        raise ValueError(e)

    db.create_all()

    db.session.commit()
コード例 #3
0
ファイル: setup_tests.py プロジェクト: rioscesar/Plunjr-API
    def _create_temp_test_db(self):
        try:
            db.reflect()
            db.drop_all()
        except SQLAlchemyError:
            pass

        db.create_all()

        db.session.commit()
        db.session.flush()
コード例 #4
0
ファイル: test_flaskapp.py プロジェクト: minhdang900/python
 def tearDown(self):
     """Test Suite Tear down."""
     db.session.remove()
     db.drop_all()
コード例 #5
0
# This file helps to create the relevant tables in the database
# The schema follow as what is defined in the Model classses in ./models folder
# To add a new schema, the model class should import db from flaskapp and extends from it.

# load the database environment variables
from dotenv import load_dotenv

load_dotenv()
from flaskapp import db

from flaskapp.model import *

db.drop_all()
コード例 #6
0
def recreate_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
コード例 #7
0
ファイル: base.py プロジェクト: kkornel/flask-social-app
 def tearDown(self):
     """
     Will be called after every test
     """
     db.session.remove()
     db.drop_all()
コード例 #8
0
ファイル: test.py プロジェクト: liubbn/flask_web
 def tearDown(self):
     db.session.remove()
     db.drop_all()
コード例 #9
0
 def tearDown(self):
     """Destroy blank temp database after each test"""
     db.drop_all()
コード例 #10
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
コード例 #11
0
 def setUp(self):
     from flaskapp import db
     db.drop_all()
     db.create_all()
コード例 #12
0
ファイル: setup_tests.py プロジェクト: rioscesar/Plunjr-API
    def master_test_teardown(self):
        # This is necessary to commit any pending transactions, which will make Postgres lock on DROP table queries
        db.session.commit()

        db.drop_all()
コード例 #13
0
    def __repr__(self):
        return f"Utente('{self.utente_id}', '{self.lunedi}', '{self.martedi}', '{self.mercoledi}', '{self.giovedi}', '{self.venerdi}', '{self.sabato}', '{self.domenica}')"


# db.drop_all()
db.create_all()

comune_1 = Comune(nome="Verona", cap="3700")
db.session.add(comune_1)
comune_2 = Comune(nome="Rovereto", cap="3900")
db.session.add(comune_2)
comune_3 = Comune(nome="Malcesine", cap="4000")
db.session.add(comune_3)

db.session.commit()
'''
drop database beni_primari;
create database beni_primari;

#POPOLAMENTO
from flaskapp.models import db
from flaskapp import bcrypt
db.drop_all()
db.create_all()
from flaskapp.models import Comune, Prodotto, Utente, Giorni_Disponibili, Comune_Prodotto, Donazione, Ritiro

comune_1 = Comune(nome="Verona", cap="3700")
db.session.add(comune_1)
comune_2 = Comune(nome="Rovereto", cap="3900")
db.session.add(comune_2)