コード例 #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)
コード例 #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)
コード例 #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")
コード例 #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()
コード例 #5
0
ファイル: test_server.py プロジェクト: richa-d/lab-bluemix-cf
 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)
コード例 #6
0
ファイル: test_pets.py プロジェクト: yf1357/lab-flask-tdd
 def setUp(self):
     Pet.init_db(app)
     db.drop_all()  # clean up the last tests
     db.create_all()  # make our sqlalchemy tables
コード例 #7
0
def init_db(dbname="pets"):
    """ Initlaize the model """
    Pet.init_db(dbname)
コード例 #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)
コード例 #9
0
def init_db(redis=None):
    """ Initlaize the model """
    Pet.init_db(redis)
コード例 #10
0
ファイル: test_pets.py プロジェクト: hi348/lab-flask-bdd
 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)
コード例 #11
0
 def setUp(self):
     """ Initialize the Redis database """
     Pet.init_db()
     Pet.remove_all()
コード例 #12
0
 def test_vcap_services(self):
     """ Test if VCAP_SERVICES works """
     Pet.init_db()
     self.assertIsNotNone(Pet.redis)
コード例 #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)
コード例 #14
0
ファイル: service.py プロジェクト: rudi116/lab-flask-rest
def init_db():
    """ Initialies the SQLAlchemy app """
    global app
    Pet.init_db(app)
コード例 #15
0
 def setUp(self):
     self.app = app.test_client()
     Pet.init_db("tests")
     Pet.remove_all()
コード例 #16
0
ファイル: test_pets.py プロジェクト: hi348/lab-flask-bdd
 def test_vcap_no_services(self):
     """ Test BINDING_CLOUDANT """
     Pet.init_db("test")
     self.assertIsNotNone(Pet.client)
     self.assertIsNotNone(Pet.database)
コード例 #17
0
 def setUp(self):
     """ Initialize the Cloudant database """
     Pet.init_db("test")
     Pet.remove_all()
コード例 #18
0
ファイル: test_pets.py プロジェクト: hi348/lab-flask-bdd
 def test_vcap_no_services(self):
     """ Test VCAP_SERVICES without Cloudant """
     Pet.init_db("test")
     self.assertIsNotNone(Pet.client)
     self.assertIsNotNone(Pet.database)