Beispiel #1
0
 def setUp(self):
     #unittest.TestCase.setUp(self)
     app.config['TESTING']=True
     app.config['CSRF_ENABLED'] = False
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'test.db')
     self.app = app.test_client()
     db.create_all()  
Beispiel #2
0
	def setUp(self):
		db.create_all()
		admin = User(username="******", email="ausers;[email protected]", password="******")
		user = User(username="******", email="*****@*****.**", password="******")

		db.session.add(admin)
		db.session.add(user)
		db.session.commit()
Beispiel #3
0
 def setUp(self):
     """Setup Flask db."""
     db.create_all()
     self.client = self.app.test_client()
     self.app.testing = True
     user = User('*****@*****.**', 'a', 'a')
     db.session.add(user)
     db.session.commit()
 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()
Beispiel #5
0
def recreate_db():
    try:
        db.reflect()
        db.drop_all()
    except SQLAlchemyError as e:
        raise ValueError(e)

    db.create_all()

    db.session.commit()
Beispiel #6
0
def appSetup():
    #create a new db
    print('Creating New Database')
    db.create_all(app=app)

    #populate the new empty db with the past csv data
    print('Populating the database with past data')
    from flaskapp.database.populate_db import PopulateDB
    with app.app_context():
        PopulateDB()
Beispiel #7
0
    def _create_temp_test_db(self):
        try:
            db.reflect()
            db.drop_all()
        except SQLAlchemyError:
            pass

        db.create_all()

        db.session.commit()
        db.session.flush()
Beispiel #8
0
def create():
    # 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()
Beispiel #9
0
def CreateAdmin(downloadimages):
    username = "******"
    email = "*****@*****.**"
    password = "******"
    admin = "y"
    db.create_all()
    hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')
    user = User(username=username,
                email=email,
                password=hashed_password,
                admin=admin)
    db.session.add(user)
    db.session.commit()
    PopulateDatabase(downloadimages)
Beispiel #10
0
    def setUp(self):
        """
        Will be called before every test
        """
        db.create_all()

        self.user1 = User(
            email='*****@*****.**',
            username='******',
            password=self.TEST_HASHED_PASSWORD,
        )
        self.user2 = User(
            email='*****@*****.**',
            username='******',
            password=self.TEST_HASHED_PASSWORD,
        )
        self.user1.active = True
        self.user2.active = True

        db.session.add(self.user1)
        db.session.add(self.user2)
        db.session.commit()

        self.profile1 = Profile(user_id=self.user1.id, user=self.user1)
        self.profile2 = Profile(user_id=self.user2.id, user=self.user2)

        db.session.add(self.profile1)
        db.session.add(self.profile2)
        db.session.commit()

        self.post1 = Post(
            author_id=self.profile1.id,
            content='Post1',
            location='Tomaszów Mazowiecki',
        )
        self.post2 = Post(
            author_id=self.profile2.id,
            content='Post2',
            location='Tomaszów Mazowiecki',
        )
        db.session.add(self.post1)
        db.session.add(self.post2)
        db.session.commit()
Beispiel #11
0
    def setUp(self):
        """
        Will be called before every test
        """
        db.create_all()

        user = User(
            email=self.TEST_USER_EMAIL,
            username=self.TEST_USER_USERNAME,
            password=self.TEST_HASHED_PASSWORD,
        )
        user.active = True

        db.session.add(user)
        db.session.commit()

        profile = Profile(user_id=user.id, user=user)

        db.session.add(profile)
        db.session.commit()
Beispiel #12
0
def create_tables():
    db.create_all()
Beispiel #13
0
def create_db():
    from flaskapp import app, db
    db.create_all()
Beispiel #14
0
def recreate_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
def create_db():
    from flaskapp import db
    db.create_all()
    return redirect(url_for('main.landing'))
Beispiel #16
0
 def setUp(self):
     from flaskapp import db
     db.drop_all()
     db.create_all()
Beispiel #17
0
from flaskapp import create_app, db

# Instantiating app to create_app class in __init__.py file
app = create_app()
app.app_context().push()

# Run Flask app in DEBUG MODE
if __name__ == '__main__':
    db.create_all(app=create_app())
    app.run(debug=True)
Beispiel #18
0
def main():
    if path.exists('flaskapp' + sep + 'data.db'):
        remove('flaskapp' + sep + 'data.db')
    db.create_all()
Beispiel #19
0
def createTableBasedOnModel():
    db.create_all()
    db.session.commit()
    return "SUCCESES??", 200
Beispiel #20
0
from flask import Flask
from flask import request

from flaskapp import app, db

from API.User import User as User
from API.Drone import Drone as Drone
from API.Mission import Mission as Mission
from API.Document import Document as Document

#db.drop_all()
db.create_all()

@app.after_request
def apply_caching(response):
    response.headers["Access-Control-Allow-Credentials"] = "true"
    return response

if __name__ == '__main__':
   app.run(host="0.0.0.0", port=5000)
Beispiel #21
0
 def setUp(self):
     db.create_all()
     db.session.commit()
#!/usr/bin/env python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from flaskapp import db
import os.path

db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
    api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
    api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
else:
    api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))
Beispiel #23
0
def init_database():
    """ Create database using sqlalchemy Model"""
    #app.config.from_object('flaskapp.settings.DevelopmentConfig')
    db.create_all()