Exemplo n.º 1
0
    def setUp(self):
        '''Set up before each test'''
        # Create an app instance using the testing configuration
        self.app = create_app('testing')

        # Creating the app_context means the tests will have
        # access to current_app
        self.app_context = self.app.app_context()
        self.app_context.push()
Exemplo n.º 2
0
    def setUp(self):
        '''Set up before each test'''
        # Create an app instance using the testing configuration
        self.app = create_app('testing')

        # Creating the app_context means the tests will have
        # access to current_app
        self.app_context = self.app.app_context()
        self.app_context.push()
Exemplo n.º 3
0
 def setUpClass(cls):
     """Setup code for the test case"""
     # Create an app instance using the testing configuration
     cls.app = create_app("testing")
     # Initialize the testing database
     manage.init_db(no_confirm=True)
Exemplo n.º 4
0
 def setUpClass(cls):
     '''Setup code for the test case'''
     # Create an app instance using the testing configuration
     cls.app = create_app('testing')
     # Initialize the testing database
     manage.init_db(no_confirm=True)
Exemplo n.º 5
0
First, we create an app object (which is in fact an instance of the Flask class)
using the create_app factory function defined in the sales_finder package.

Then we create a manager object to allow the user to run functions from the command
line. We attach the manager object to the app object.
'''

import os
from flask.ext.script import Manager, Shell, prompt_bool
from sqlalchemy.exc import SQLAlchemyError

from sales_finder import create_app, db, sales_data

# Create an app object, either using the FLASK_CONFIG environment
# variable, or else the default config object
app = create_app(os.getenv('FLASK_CONFIG') or 'default')

# Initialize the manager object, so we can easily use command line
# to set up/configure/launch the app
manager = Manager(app)



""" Define manager commands """
# The manager object allows us to add commands that the user can call from
# the command line. Each command is just a way to call a function, which we define
# in this module. Note that -runserver- is added as a command by default.
# -shell- is also a default command, but we re-define it to add the application context


Exemplo n.º 6
0
First, we create an app object (which is in fact an instance of the Flask class)
using the create_app factory function defined in the sales_finder package.

Then we create a manager object to allow the user to run functions from the command
line. We attach the manager object to the app object.
'''

import os
from flask.ext.script import Manager, Shell, prompt_bool
from sqlalchemy.exc import SQLAlchemyError

from sales_finder import create_app, db, sales_data

# Create an app object, either using the FLASK_CONFIG environment
# variable, or else the default config object
app = create_app(os.getenv('FLASK_CONFIG') or 'default')

# Initialize the manager object, so we can easily use command line
# to set up/configure/launch the app
manager = Manager(app)
""" Define manager commands """
# The manager object allows us to add commands that the user can call from
# the command line. Each command is just a way to call a function, which we define
# in this module. Note that -runserver- is added as a command by default.
# -shell- is also a default command, but we re-define it to add the application context
'''
shell command

This command allows us to launch a shell with the objects our app will use already
created, in the form of a _context_. That way, we can debug, and also interact with
the database just as our app would.