File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ services:
13
13
- ..:/app
14
14
command : sleep infinity
15
15
environment :
16
- FLASK_APP : service :app
16
+ FLASK_APP : wsgi :app
17
17
FLASK_DEBUG : " True"
18
18
GUNICORN_BIND : " 0.0.0.0:8000"
19
19
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
29
29
$(info Running tests...)
30
30
pytest --disable-warnings
31
31
32
+ db-create : # # Creates the database tables
33
+ $(info Creating database tables...)
34
+ @flask db-create
35
+
32
36
# #@ Runtime
33
37
34
38
run : # # Run the service
Original file line number Diff line number Diff line change 1
1
"""
2
2
CLI Command Extensions for Flask
3
3
"""
4
+
4
5
import os
5
6
from unittest import TestCase
6
7
from unittest .mock import patch , MagicMock
7
8
from click .testing import CliRunner
9
+
8
10
# pylint: disable=unused-import
9
11
from wsgi import app # noqa: F401
10
12
from service .common .cli_commands import db_create # noqa: E402
@@ -16,10 +18,10 @@ class TestFlaskCLI(TestCase):
16
18
def setUp (self ):
17
19
self .runner = CliRunner ()
18
20
19
- @patch (' service.common.cli_commands.db' )
21
+ @patch (" service.common.cli_commands.db" )
20
22
def test_db_create (self , db_mock ):
21
23
"""It should call the db-create command"""
22
24
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 ):
24
26
result = self .runner .invoke (db_create )
25
27
self .assertEqual (result .exit_code , 0 )
You can’t perform that action at this time.
0 commit comments