Skip to content

Commit f743b2f

Browse files
committed
✅ fix tests
1 parent 6c4959e commit f743b2f

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DB_NAME=dbname
22
DB_USER=dbuser
3-
DB_PASSWORD=dbpaswword
3+
DB_PASSWORD=dbpassword
44
ALLOWED_HOSTS=localhost,127.0.0.1
55
DEBUG=1
66
SECRET_KEY=a-strong-secret-key

.github/workflows/test_ci.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
name: Tests CI
22
on: [push]
3+
env:
4+
SECRET_KEY: a-strong-secret-key
5+
DB_NAME: dbname
6+
DB_USER: dbuser
7+
DB_PASSWORD: dbpassword
8+
DB_HOST: 127.0.0.1
39
jobs:
410
Run-CI-Tests:
511
runs-on: ubuntu-latest
12+
services:
13+
# Label used to access the service container
14+
postgres:
15+
image: postgres
16+
env:
17+
POSTGRES_DB: dbname
18+
POSTGRES_USER: dbuser
19+
POSTGRES_PASSWORD: dbpassword
20+
ports:
21+
- 5432:5432
22+
# Set health checks to wait until postgres has started
23+
options: >-
24+
--health-cmd pg_isready
25+
--health-interval 10s
26+
--health-timeout 5s
27+
--health-retries 5
628
steps:
729
- uses: actions/checkout@v3
8-
- run: docker-compose up -d
9-
- run: docker exec messages-web-container python messages/manage.py test apps
30+
- uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.11'
33+
- run: pip install -r requirements.txt
34+
- run: python messages/manage.py test apps

messages/messages/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
SECRET_KEY = os.environ.get("SECRET_KEY")
2525

2626
# SECURITY WARNING: don't run with debug turned on in production!
27-
DEBUG = bool(int(os.environ.get("DEBUG", 0)))
27+
DEBUG = bool(int(os.environ.get("DEBUG", 0))) if os.environ.get("DEBUG") else False
2828

2929
ALLOWED_HOSTS = []
3030
ALLOWED_HOSTS.extend(filter(None, os.environ.get("ALLOWED_HOSTS", "").split(",")))

0 commit comments

Comments
 (0)