Skip to content

Commit

Permalink
add test for sign_up endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Lopkop committed May 10, 2024
1 parent 52219d5 commit 4898c44
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/api/auth/test_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import json

import pytest
from fastapi.testclient import TestClient

from main import app

client = TestClient(app)


@pytest.mark.parametrize('user,status',
[
({'name': 'new_user', 'password': 'test', 'lifetime': 1}, 200),
({'name': 'existing_user', 'password': 'test', 'lifetime': 2}, 401),
({'name': 'bad_user', 'password': 'test'}, 422),
])
def test_sign_up(fill_db, user: dict, status: int):
req = client.post('/api/sign-up', content=json.dumps(user))
assert req.status_code == status
assert 1 == 1

0 comments on commit 4898c44

Please sign in to comment.