kenken999's picture
test
ba19a97
raw
history blame
1.3 kB
import pytest
from fastapi.testclient import TestClient
from api.app import app
client = TestClient(app)
def test_create_user():
response = client.post("/users/", json={"username": "test", "password": "test"})
assert response.status_code == 201
def test_create_team():
response = client.post("/teams/", json={"name": "test"})
assert response.status_code == 201
def test_read_users():
response = client.get("/users/")
assert response.status_code == 200
def test_read_teams():
response = client.get("/teams/")
assert response.status_code == 200
def test_read_user():
response = client.get("/users/1")
assert response.status_code == 200
def test_read_team():
response = client.get("/teams/1")
assert response.status_code == 200
def test_update_user():
response = client.put("/users/1", json={"username": "test", "password": "test", "profile": "test", "tags": "test"})
assert response.status_code == 200
def test_update_team():
response = client.put("/teams/1", json={"name": "test"})
assert response.status_code == 200
def test_delete_user():
response = client.delete("/users/1")
assert response.status_code == 204
def test_delete_team():
response = client.delete("/teams/1")
assert response.status_code == 204