Skip to content

Commit 160cf18

Browse files
author
EliuX
committed
Solves #46
1 parent ae3ea91 commit 160cf18

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

requirements/dev.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@ pytest-mock==2.0.0
1212
Faker==4.0.2
1313

1414
# Coverage
15-
coverage==4.5.1
16-
17-
# The Debug Toolbar
18-
Flask-DebugToolbar==0.11.0
15+
coverage==4.5.1

requirements/prod.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ SQLAlchemy-Utils==0.36.3
2828
flask_sqlalchemy==2.4.1
2929

3030
# Handling requests
31-
requests==2.23.0
31+
requests==2.23.0
32+
33+
# The Debug Toolbar
34+
Flask-DebugToolbar==0.11.0

tests/smoke_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
from flask_restplus._http import HTTPStatus
66
from pytest_mock import MockFixture
77

8+
unexpected_errors_to_be_handled = [pyodbc.OperationalError]
9+
810

911
def test_app_exists(app):
1012
assert app is not None
1113

1214

13-
unexpected_errors_to_be_handled = [pyodbc.OperationalError]
14-
15-
1615
@pytest.mark.parametrize("error_type", unexpected_errors_to_be_handled)
1716
def test_exceptions_are_handled(error_type, client: FlaskClient, mocker: MockFixture):
1817
from time_tracker_api.time_entries.time_entries_namespace import time_entries_dao

time_tracker_api/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from time_tracker_api.security import generate_dev_secret_key
44

5+
DISABLE_STR_VALUES = ("false", "0", "disabled")
6+
57

68
class Config:
79
SECRET_KEY = generate_dev_secret_key()
@@ -32,13 +34,14 @@ class TestConfig(SQLConfig):
3234

3335

3436
class ProductionConfig(Config):
35-
DEBUG = False
37+
DEBUG = os.environ.get('DEBUG', "false").lower() not in DISABLE_STR_VALUES
3638
FLASK_DEBUG = True
3739
FLASK_ENV = 'production'
3840

3941

4042
class AzureConfig(SQLConfig):
41-
DATABASE_URI = os.environ.get('SQLAZURECONNSTR_DATABASE_URI')
43+
DATABASE_URI = os.environ.get('DATABASE_URI', os.environ.get('SQLAZURECONNSTR_DATABASE_URI'))
44+
SQLALCHEMY_DATABASE_URI = DATABASE_URI
4245

4346

4447
class AzureDevelopmentConfig(DevelopmentConfig, AzureConfig):

0 commit comments

Comments
 (0)