Skip to content

Commit 91420f2

Browse files
authored
Merge pull request #29 from nyu-devops/fix-db-create
Fix db-create not working
2 parents d940941 + af3babd commit 91420f2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.devcontainer/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff 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

Makefile

+4
Original file line numberDiff line numberDiff 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

3438
run: ## Run the service

tests/test_cli_commands.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
"""
22
CLI Command Extensions for Flask
33
"""
4+
45
import os
56
from unittest import TestCase
67
from unittest.mock import patch, MagicMock
78
from click.testing import CliRunner
9+
810
# pylint: disable=unused-import
911
from wsgi import app # noqa: F401
1012
from 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)

0 commit comments

Comments
 (0)