Skip to content

Commit 5ec3a00

Browse files
committed
add a few tests
1 parent 5bded73 commit 5ec3a00

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

.github/workflows/deploy_lambda.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
- uses: actions/setup-python@v5
2929
with:
3030
python-version: "3.12"
31+
cache: "pytest"
32+
- run: |
33+
python -m pytest
3134
3235
- name: Install and configure Poetry
3336
uses: snok/install-poetry@v1
@@ -46,9 +49,6 @@ jobs:
4649
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
4750
run: poetry install --no-interaction
4851

49-
- name: Run tests
50-
run: poetry run pytest
51-
5252
- uses: aws-actions/configure-aws-credentials@v4
5353
with:
5454
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ jobs:
2020
- uses: actions/setup-python@v5
2121
with:
2222
python-version: "3.12"
23-
cache: "poetry"
23+
cache: "pytest"
2424
- name: Run tests
2525
run: |
26-
pip install poetry
27-
poetry install --no-interaction
28-
poetry run pytest
26+
python -m pytest

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@
7777
"!Split",
7878
"!Join sequence"
7979
],
80+
"python.testing.pytestArgs": [
81+
"tests"
82+
],
8083
}

tests/unit/app/auth/models_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import pytest
2+
from pydantic import ValidationError
3+
4+
from app.auth.models import SignUpData
5+
6+
7+
def test_signup_data_valid():
8+
data = SignUpData(email="test@example.com", password="strongpassword123")
9+
assert data.email == "test@example.com"
10+
assert data.password == "strongpassword123"
11+
12+
13+
def test_signup_data_invalid_email():
14+
with pytest.raises(ValidationError):
15+
SignUpData(email="invalid-email", password="strongpassword123")
16+
17+
18+
def test_signup_data_missing_email():
19+
with pytest.raises(ValidationError):
20+
SignUpData(password="strongpassword123")
21+
22+
23+
def test_signup_data_missing_password():
24+
with pytest.raises(ValidationError):
25+
SignUpData(email="test@example.com")

0 commit comments

Comments
 (0)