Python app.db.drop_all() Examples

The following are 30 code examples of app.db.drop_all(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module app.db , or try the search function .
Example #1
Source File: test_integration.py    From restful-todo with GNU General Public License v2.0 6 votes vote down vote up
def setUpClass(cls):
        # start Firefox
        try:
            cls.client = webdriver.Firefox()
        except:
            pass

        if cls.client:
            cls.app = create_app('testing')
            cls.app_context = cls.app.app_context()
            cls.app_context.push()


            db.drop_all()
            db.create_all()
            todo = Todo(title='title1', body='body1')
            db.session.add(todo)
            db.session.commit()


            threading.Thread(target=cls.app.run).start() 
Example #2
Source File: test_user_model.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #3
Source File: seed_command.py    From flaskerize with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def run(self):
        if (
            input(
                "Are you sure you want to drop all tables and recreate? (y/N)\n"
            ).lower()
            == "y"
        ):
            print("Dropping tables...")
            db.drop_all()
            db.create_all()
            seed_things()
            db.session.commit()
            print("DB successfully seeded.") 
Example #4
Source File: test_user_model.py    From flask-base with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #5
Source File: test_basics.py    From flasky-with-celery with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #6
Source File: test_selenium.py    From flasky-with-celery with MIT License 5 votes vote down vote up
def tearDownClass(cls):
        if cls.client:
            # stop the flask server and the browser
            cls.client.get('http://localhost:5000/shutdown')
            cls.client.close()

            # destroy database
            db.drop_all()
            db.session.remove()

            # remove application context
            cls.app_context.pop() 
Example #7
Source File: test_client.py    From flasky-with-celery with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #8
Source File: test_user_model.py    From flask-blog with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #9
Source File: test_basics.py    From flask-blog with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #10
Source File: test_auth.py    From flask-rest-api with MIT License 5 votes vote down vote up
def setUp(self):
        """Set up test variables."""
        self.app = create_app(config_name="testing")
        self.client = self.app.test_client
        self.user_data = {
            'email': 'test@example.com',
            'password': 'test_password'
        }

        with self.app.app_context():
            # create all tables
            db.session.close()
            db.drop_all()
            db.create_all() 
Example #11
Source File: test_bucketlist.py    From flask-rest-api with MIT License 5 votes vote down vote up
def setUp(self):
        """Define test variables and initialize app."""
        self.app = create_app(config_name="testing")
        self.client = self.app.test_client
        self.bucketlist = {'name': 'Go to Borabora for vacay'}

        # binds the app to the current context
        with self.app.app_context():
            # create all tables
            db.session.close()
            db.drop_all()
            db.create_all() 
Example #12
Source File: conftest.py    From fitbit-api-example-python with Apache License 2.0 5 votes vote down vote up
def flask_app(monkeypatch):
    monkeypatch.setenv('FLASK_CONFIG', 'testing')
    f_app = create_app(config['testing'])
    db.create_all()
    yield f_app
    db.session.close()
    db.drop_all() 
Example #13
Source File: test_user_model.py    From flasky-with-celery with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #14
Source File: test_user_model.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #15
Source File: test_user_model.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #16
Source File: test_login.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #17
Source File: test_user_model.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #18
Source File: test_login.py    From oreilly-intro-to-flask-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.drop_all()
        self.app_ctx.pop() 
Example #19
Source File: manage.py    From flask-boilerplate with MIT License 5 votes vote down vote up
def dropdb():
    ''' Delete the SQL database. '''
    if prompt_bool('Are you sure you want to lose all your SQL data?'):
        db.drop_all()
        print(colored('The SQL database has been deleted', 'green')) 
Example #20
Source File: __init__.py    From tutorial-flask with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        """teardown all initialized variables."""
        with self.app.app_context():
            # Elimina todas las tablas de la base de datos
            db.session.remove()
            db.drop_all() 
Example #21
Source File: tests.py    From oreilly-flask-apis-video with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.ctx.pop() 
Example #22
Source File: tests.py    From oreilly-flask-apis-video with MIT License 5 votes vote down vote up
def setUp(self):
        self.app = create_app('testing')
        self.ctx = self.app.app_context()
        self.ctx.push()
        db.drop_all()
        db.create_all()
        u = User(username=self.default_username)
        u.set_password(self.default_password)
        db.session.add(u)
        db.session.commit()
        self.client = TestClient(self.app, u.generate_auth_token(), '') 
Example #23
Source File: test_client.py    From flasky-first-edition with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #24
Source File: test_selenium.py    From flasky-first-edition with MIT License 5 votes vote down vote up
def tearDownClass(cls):
        if cls.client:
            # stop the flask server and the browser
            cls.client.get('http://localhost:5000/shutdown')
            cls.client.close()

            # destroy database
            db.drop_all()
            db.session.remove()

            # remove application context
            cls.app_context.pop() 
Example #25
Source File: test_basics.py    From flasky-first-edition with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #26
Source File: test_user_model.py    From flasky-first-edition with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #27
Source File: test_api.py    From flasky-first-edition with MIT License 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #28
Source File: test_integration.py    From restful-todo with GNU General Public License v2.0 5 votes vote down vote up
def tearDownClass(cls):
        if cls.client:
            cls.client.close()

            db.drop_all()
            db.session.remove()

            cls.app_context.pop() 
Example #29
Source File: test_apis.py    From restful-todo with GNU General Public License v2.0 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop() 
Example #30
Source File: test_skeleton.py    From restful-todo with GNU General Public License v2.0 5 votes vote down vote up
def tearDown(self):
        db.session.remove()
        db.drop_all()
        self.app_context.pop()