Spaces:
Sleeping
Sleeping
""" | |
Unit tests for the index.py file | |
""" | |
from fastapi.testclient import TestClient | |
from index import app | |
client = TestClient(app) | |
def test_read_root(): | |
response = client.get("/") | |
assert response.status_code == 200 | |
assert response.json() == {"Hello": "World"} | |
def test_post_github_access_token_route(): | |
response = client.post("/github/access_token", json={"token": "test_token", "user_email": "test_email"}) | |
assert response.status_code == 200 | |
def test_post_github_repo_route(): | |
response = client.post("/github/repo", json={"repo_name": "test_repo", "user_email": "test_email"}) | |
assert response.status_code == 200 | |
def test_index_github_repo_route(): | |
response = client.post("/github/index", json={"repo_name": "test_repo", "user_email": "test_email"}) | |
assert response.status_code == 200 | |
def test_query_github_repo_route(): | |
response = client.get("/github/query", json={"repo_name": "test_repo", "query": "test_query"}) | |
assert response.status_code == 200 | |