28 lines
791 B
Python
28 lines
791 B
Python
"""Test user endpoints."""
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from app.main import app
|
|
|
|
|
|
class TestUsers:
|
|
"""Test user endpoints."""
|
|
|
|
def test_get_users(self, client: TestClient, auth_headers: dict):
|
|
"""Test getting users list."""
|
|
response = client.get("/api/v1/users/", headers=auth_headers)
|
|
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert "users" in data
|
|
assert "total" in data
|
|
|
|
def test_get_me(self, client: TestClient, auth_headers: dict):
|
|
"""Test getting current user."""
|
|
response = client.get("/api/v1/users/me", headers=auth_headers)
|
|
|
|
assert response.status_code == 200
|
|
data = response.json()
|
|
assert "id" in data
|
|
assert "email" in data
|