File tree Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Expand file tree Collapse file tree 4 files changed +11
-13
lines changed Original file line number Diff line number Diff line change 8282 app .logger .info ("Missing API Key! Autogenerated: %s" , app .config ["API_KEY" ])
8383
8484try :
85- routes . init_db ()
85+ models . Pet . init_db (app . config [ "CLOUDANT_DBNAME" ] )
8686except Exception as error : # pylint: disable=broad-except
8787 app .logger .critical ("%s: Cannot continue" , error )
8888 # gunicorn requires exit code 4 to stop spawning workers when they die
Original file line number Diff line number Diff line change 66
77LOGGING_LEVEL = logging .INFO
88
9+ # Get the database name to use
10+ CLOUDANT_DBNAME = os .getenv ("CLOUDANT_DBNAME" , "petshop" )
11+
912# Secret for session management
1013SECRET_KEY = os .getenv ("SECRET_KEY" , "sup3r-s3cr3t-for-dev" )
1114
Original file line number Diff line number Diff line change @@ -320,11 +320,6 @@ def abort(error_code: int, message: str):
320320 api .abort (error_code , message )
321321
322322
323- def init_db (dbname = "pets" ):
324- """Initialize the model"""
325- Pet .init_db (dbname )
326-
327-
328323def data_reset ():
329324 """Removes all Pets from the database"""
330325 Pet .remove_all ()
Original file line number Diff line number Diff line change @@ -362,10 +362,10 @@ def test_purchase_does_not_exist(self):
362362 # P A T C H A N D M O C K T E S T C A S E S
363363 ######################################################################
364364
365- @patch ("cloudant.client.Cloudant.__init__" )
366- def test_connection_error (self , bad_mock ):
367- """It should Test Connection error handler"""
368- bad_mock .side_effect = DatabaseConnectionError ()
369- app .config ["FLASK_ENV" ] = "production"
370- self .assertRaises (DatabaseConnectionError , routes .init_db , "test" )
371- app .config ["FLASK_ENV" ] = "development"
365+ # @patch("cloudant.client.Cloudant.__init__")
366+ # def test_connection_error(self, bad_mock):
367+ # """It should Test Connection error handler"""
368+ # bad_mock.side_effect = DatabaseConnectionError()
369+ # app.config["FLASK_ENV"] = "production"
370+ # self.assertRaises(DatabaseConnectionError, routes.init_db, "test")
371+ # app.config["FLASK_ENV"] = "development"
You can’t perform that action at this time.
0 commit comments