def test_vcap_services(self):
     """ Test if VCAP_SERVICES works """
     if 'VCAP_SERVICES' in os.environ:
         Promotion.init_db()
         self.assertIsNotNone(Promotion.redis)
     else:
         with patch.dict(os.environ, {'VCAP_SERVICES': json.dumps(VCAP_SERVICES)}):
             Promotion.init_db()
             self.assertIsNotNone(Promotion.redis)
def init_db(redis=None):
    ''' Initialize the model '''
    Promotion.init_db(redis)
 def setUp(self):
     Promotion.init_db()
     Promotion.remove_all()
 def test_passing_connection(self):
     """ Pass in the Redis connection """
     if 'VCAP_SERVICES' not in os.environ:
         Promotion.init_db(Redis(host='127.0.0.1', port=6379))
         self.assertIsNotNone(Promotion.redis)
Exemple #5
0
 def setUp(self):
     """ Initialize the Cloudant database """
     Promotion.init_db("test_promotion")
     Promotion.remove_all()
def init_db():
    """ Initialies the SQLAlchemy app """
    Promotion.init_db()
Exemple #7
0
def init_db(dbname="promotions"):
    """ Initlaize the model """
    Promotion.init_db(dbname)