Exemplo n.º 1
0
 def setUpClass(cls):
     """ These run once per Test suite """
     app.config['TESTING'] = True
     app.config['DEBUG'] = False
     app.config["SQLALCHEMY_DATABASE_URI"] = DATABASE_URI
     app.logger.setLevel(logging.CRITICAL)
     Pet.init_db(app)
Exemplo n.º 2
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)
     Pet.init_db(app)
Exemplo n.º 3
0
 def test_vcap_services(self):
     """ Test if VCAP_SERVICES works """
     Pet.init_db()
     self.assertIsNotNone(Pet.client)
     Pet("fido", "dog", True).save()
     pets = Pet.find_by_name("fido")
     self.assertNotEqual(len(pets), 0)
     self.assertEqual(pets[0].name, "fido")
Exemplo n.º 4
0
 def setUp(self):
     """ Initialize the Cloudant database """
     self.app = app.test_client()
     Pet.init_db("tests")
     Pet.remove_all()
     Pet("fido", "dog", True).save()
     Pet("kitty", "cat", True).save()
     Pet("harry", "hippo", False).save()
Exemplo n.º 5
0
 def setUp(self):
     """ Initialize the Cloudant database """
     self.app = app.test_client()
     Pet.init_db("tests")
     # Cloudant Lite will rate limit so you must sleep between requests :()
     sleep(0.5)
     Pet.remove_all()
     sleep(0.5)
     Pet("fido", "dog", True).save()
     sleep(0.5)
     Pet("kitty", "cat", True).save()
     sleep(0.5)
     Pet("harry", "hippo", False).save()
     sleep(0.5)
Exemplo n.º 6
0
 def setUp(self):
     Pet.init_db(app)
     db.drop_all()  # clean up the last tests
     db.create_all()  # make our sqlalchemy tables
Exemplo n.º 7
0
def init_db(dbname="pets"):
    """ Initlaize the model """
    Pet.init_db(dbname)
Exemplo n.º 8
0
 def setUpClass(cls):
     """ These run once before Test suite """
     app.debug = False
     # Set up the test database
     app.config["SQLALCHEMY_DATABASE_URI"] = DATABASE_URI
     Pet.init_db(app)
Exemplo n.º 9
0
def init_db(redis=None):
    """ Initlaize the model """
    Pet.init_db(redis)
Exemplo n.º 10
0
 def test_vcap_with_binding(self):
     """ Test no VCAP_SERVICES with BINDING_CLOUDANT """
     Pet.init_db("test")
     self.assertIsNotNone(Pet.client)
     self.assertIsNotNone(Pet.database)
Exemplo n.º 11
0
 def setUp(self):
     """ Initialize the Redis database """
     Pet.init_db()
     Pet.remove_all()
Exemplo n.º 12
0
 def test_vcap_services(self):
     """ Test if VCAP_SERVICES works """
     Pet.init_db()
     self.assertIsNotNone(Pet.redis)
Exemplo n.º 13
0
 def test_passing_connection(self):
     """ Pass in the Redis connection """
     Pet.init_db(Redis(host='127.0.0.1', port=6379))
     self.assertIsNotNone(Pet.redis)
Exemplo n.º 14
0
def init_db():
    """ Initialies the SQLAlchemy app """
    global app
    Pet.init_db(app)
Exemplo n.º 15
0
 def setUp(self):
     self.app = app.test_client()
     Pet.init_db("tests")
     Pet.remove_all()
Exemplo n.º 16
0
 def test_vcap_no_services(self):
     """ Test BINDING_CLOUDANT """
     Pet.init_db("test")
     self.assertIsNotNone(Pet.client)
     self.assertIsNotNone(Pet.database)
Exemplo n.º 17
0
 def setUp(self):
     """ Initialize the Cloudant database """
     Pet.init_db("test")
     Pet.remove_all()
Exemplo n.º 18
0
 def test_vcap_no_services(self):
     """ Test VCAP_SERVICES without Cloudant """
     Pet.init_db("test")
     self.assertIsNotNone(Pet.client)
     self.assertIsNotNone(Pet.database)