Exemple #1
0
 def setUpClass(cls):
     """ This runs once before the entire test suite """
     app.config['TESTING'] = True
     app.config['DEBUG'] = False
     app.config["SQLALCHEMY_DATABASE_URI"] = DATABASE_URI
     app.logger.setLevel(logging.CRITICAL)
     Supplier.init_db(app)
Exemple #2
0
 def test_vcap_services(self):
     """ Test VCAP_SERVICES """
     if 'VCAP_SERVICES' not in os.environ:
         os.environ.update({'VCAP_SERVICES': json.dumps(VCAP_SERVICES)})
     Supplier.init_db("test")
     self.assertIsNotNone(Supplier.client)
     self.assertIsNotNone(Supplier.database)
Exemple #3
0
def init_db():
    """ Initialies the SQLAlchemy app """
    global app
    Supplier.init_db(app)
Exemple #4
0
def init_db():
    """ Initialies the mongoengine """
    global app
    Supplier.init_db(app)
Exemple #5
0
 def setUp(self):
     """ Initialize the Cloudant database """
     Supplier.init_db("test")
     Supplier.remove_all()
Exemple #6
0
 def setUp(self):
     self.app = app.test_client()
     initialize_logging(logging.INFO)
     Supplier.init_db("test")
     Supplier.remove_all()
Exemple #7
0
from . import app

# Error handlers require app to be initialized so we must import
# them only after we have initialized the Flask app instance

# Document the type of autorization required
authorizations = {
    'apikey': {
        'type': 'apiKey',
        'in': 'header',
        'name': 'X-Api-Key'
    }
}

# initialize DB without @app.before_first_request, to prevent nosetests using supplier DB
Supplier.init_db("suppliers")


######################################################################
# GET HOME PAGE
######################################################################
@app.route('/')
def index():
    """ Render Home Page"""
    return app.send_static_file('index.html')


######################################################################
# Configure Swagger before initilaizing it
######################################################################
api = Api(