Skip to content

Commit 8dbda40

Browse files
Merge pull request #23 from Promptly-Technologies-LLC/22-set-up-an-automated-ci-testlint-workflow-to-validate-prs
CI test workflow LFG
2 parents 7dcdc3d + a1bad89 commit 8dbda40

File tree

2 files changed

+72
-3
lines changed

2 files changed

+72
-3
lines changed

.github/workflows/test.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.12"]
15+
poetry-version: [latest]
16+
os: [ubuntu-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
services:
21+
postgres:
22+
image: postgres:latest
23+
env:
24+
POSTGRES_DB: test_db
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
ports:
28+
- 5432:5432
29+
options: >-
30+
--health-cmd pg_isready
31+
--health-interval 10s
32+
--health-timeout 5s
33+
--health-retries 5
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Install and configure Poetry
43+
uses: snok/install-poetry@v1
44+
45+
- name: Install project
46+
run: poetry install
47+
48+
- name: Set env variables for pytest
49+
run: |
50+
echo "DB_USER=postgres" >> $GITHUB_ENV
51+
echo "DB_PASSWORD=postgres" >> $GITHUB_ENV
52+
echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV
53+
echo "DB_PORT=5432" >> $GITHUB_ENV
54+
echo "DB_NAME=test_db" >> $GITHUB_ENV
55+
echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV
56+
57+
- name: Verify environment variables
58+
run: |
59+
echo "Checking if required environment variables are set..."
60+
[ -n "$DB_USER" ] && \
61+
[ -n "$DB_PASSWORD" ] && \
62+
[ -n "$DB_HOST" ] && \
63+
[ -n "$DB_PORT" ] && \
64+
[ -n "$DB_NAME" ] && \
65+
[ -n "$SECRET_KEY" ]
66+
67+
- name: Run type checking with mypy
68+
run: poetry run mypy .
69+
70+
- name: Run tests with pytest
71+
run: poetry run pytest -s tests/

main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# ToDo: Add CSRF protection to all POST, download, and sensitive data routes
2-
31
import logging
42
from typing import Optional
53
from contextlib import asynccontextmanager
@@ -201,7 +199,7 @@ async def read_terms_of_service(params: dict = Depends(common_unauthenticated_pa
201199
return templates.TemplateResponse(params["request"], "terms_of_service.html", params)
202200

203201

204-
@app.get("/reset_password")
202+
@app.get("/auth/reset_password")
205203
async def read_reset_password(
206204
email: str,
207205
token: str,

0 commit comments

Comments
 (0)