Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Solves #46
  • Loading branch information
EliuX committed Mar 27, 2020
commit 160cf18027d4d79a432be71a5ec5db5507b481d7
5 changes: 1 addition & 4 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ pytest-mock==2.0.0
Faker==4.0.2

# Coverage
coverage==4.5.1

# The Debug Toolbar
Flask-DebugToolbar==0.11.0
coverage==4.5.1
5 changes: 4 additions & 1 deletion requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ SQLAlchemy-Utils==0.36.3
flask_sqlalchemy==2.4.1

# Handling requests
requests==2.23.0
requests==2.23.0

# The Debug Toolbar
Flask-DebugToolbar==0.11.0
5 changes: 2 additions & 3 deletions tests/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
from flask_restplus._http import HTTPStatus
from pytest_mock import MockFixture

unexpected_errors_to_be_handled = [pyodbc.OperationalError]


def test_app_exists(app):
assert app is not None


unexpected_errors_to_be_handled = [pyodbc.OperationalError]


@pytest.mark.parametrize("error_type", unexpected_errors_to_be_handled)
def test_exceptions_are_handled(error_type, client: FlaskClient, mocker: MockFixture):
from time_tracker_api.time_entries.time_entries_namespace import time_entries_dao
Expand Down
7 changes: 5 additions & 2 deletions time_tracker_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from time_tracker_api.security import generate_dev_secret_key

DISABLE_STR_VALUES = ("false", "0", "disabled")


class Config:
SECRET_KEY = generate_dev_secret_key()
Expand Down Expand Up @@ -32,13 +34,14 @@ class TestConfig(SQLConfig):


class ProductionConfig(Config):
DEBUG = False
DEBUG = os.environ.get('DEBUG', "false").lower() not in DISABLE_STR_VALUES
FLASK_DEBUG = True
FLASK_ENV = 'production'


class AzureConfig(SQLConfig):
DATABASE_URI = os.environ.get('SQLAZURECONNSTR_DATABASE_URI')
DATABASE_URI = os.environ.get('DATABASE_URI', os.environ.get('SQLAZURECONNSTR_DATABASE_URI'))
SQLALCHEMY_DATABASE_URI = DATABASE_URI


class AzureDevelopmentConfig(DevelopmentConfig, AzureConfig):
Expand Down