File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ services:
1313 - ..:/app
1414 command : sleep infinity
1515 environment :
16- FLASK_APP : service :app
16+ FLASK_APP : wsgi :app
1717 FLASK_DEBUG : " True"
1818 GUNICORN_BIND : " 0.0.0.0:8000"
1919 DATABASE_URI : postgresql+psycopg://postgres:pgs3cr3t@postgres:5432/postgres
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ test: ## Run the unit tests
2929 $(info Running tests...)
3030 pytest --disable-warnings
3131
32+ db-create : # # Creates the database tables
33+ $(info Creating database tables...)
34+ @flask db-create
35+
3236# #@ Runtime
3337
3438run : # # Run the service
Original file line number Diff line number Diff line change 11"""
22CLI Command Extensions for Flask
33"""
4+
45import os
56from unittest import TestCase
67from unittest .mock import patch , MagicMock
78from click .testing import CliRunner
9+
810# pylint: disable=unused-import
911from wsgi import app # noqa: F401
1012from service .common .cli_commands import db_create # noqa: E402
@@ -16,10 +18,10 @@ class TestFlaskCLI(TestCase):
1618 def setUp (self ):
1719 self .runner = CliRunner ()
1820
19- @patch (' service.common.cli_commands.db' )
21+ @patch (" service.common.cli_commands.db" )
2022 def test_db_create (self , db_mock ):
2123 """It should call the db-create command"""
2224 db_mock .return_value = MagicMock ()
23- with patch .dict (os .environ , {"FLASK_APP" : "service :app" }, clear = True ):
25+ with patch .dict (os .environ , {"FLASK_APP" : "wsgi :app" }, clear = True ):
2426 result = self .runner .invoke (db_create )
2527 self .assertEqual (result .exit_code , 0 )
You can’t perform that action at this time.
0 commit comments