def setUpClass(cls):
     """ Run once before all tests """
     app.debug = False
     initialize_logging(logging.INFO)
     # Set up the test database
     app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI
     init_db()
Exemple #2
0
 def setUp(self):
     self.app = service.app.test_client()
     service.initialize_logging(logging.INFO)
     Category.init_db("test")
     service.data_reset()
     service.data_load({"category_name": "A"})
     service.data_load({"category_name": "B"})
Exemple #3
0
 def setUp(self):
     self.app = service.app.test_client()
     service.initialize_logging(logging.CRITICAL)
     service.init_db()
     service.data_reset()
     service.data_load({
         "name": "fido",
         "category": "dog",
         "available": True
     })
     service.data_load({
         "name": "kitty",
         "category": "cat",
         "available": True
     })
    def setUpClass(cls):
        """ Run once before all tests """
        api_key = generate_apikey()
        app.config['API_KEY'] = api_key
        app.debug = False
        initialize_logging(logging.INFO)

        # Get API key
        api_key = generate_apikey()
        app.config['API_KEY'] = api_key

        # Set up the test database
        if DATABASE_URI:
            app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI
        db.drop_all()  # clean before all tests
        init_db()
from flask import Flask

# Get configuration from environment
SECRET_KEY = os.getenv('SECRET_KEY', 's3cr3t-key-shhhh')

# Create Flask application
app = Flask(__name__)

app.config['SECRET_KEY'] = SECRET_KEY

# Import the rutes After the Flask app is created
from service import service, models
from .models import Inventory

# Set up logging for production
service.initialize_logging()

app.logger.info(70 * '*')
app.logger.info(' I N V E N T O R Y  \
                S E R V I C E  R U N N I N G '.center(70, '*'))
app.logger.info(70 * '*')


@app.before_first_request
def init_db(dbname='asd'):
    """ Initlaize the CouchDB """
    Inventory.init_db(dbname)


app.logger.info('Service initialized!')
Exemple #6
0
 def setUpClass(cls):
     """ Run once before all tests """
     app.debug = False
     initialize_logging(logging.INFO)
Exemple #7
0
 def setUp(self):
     self.app = app.test_client()
     initialize_logging(logging.INFO)
     Supplier.init_db("test")
     Supplier.remove_all()