-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_app.py
More file actions
57 lines (45 loc) · 1.6 KB
/
test_app.py
File metadata and controls
57 lines (45 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
Simple tests for the OMI GitHub Issues Integration
"""
import pytest
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_health_endpoint():
"""Test the health check endpoint"""
response = client.get("/health")
assert response.status_code == 200
data = response.json()
assert data["status"] == "healthy"
assert data["service"] == "omi-github-issues"
def test_root_endpoint():
"""Test the root endpoint without uid"""
response = client.get("/")
assert response.status_code == 200
data = response.json()
assert data["app"] == "OMI GitHub Issues Integration"
assert data["version"] == "2.0.0"
assert data["status"] == "active"
def test_omi_tools_manifest():
"""Test the OMI tools manifest endpoint"""
response = client.get("/.well-known/omi-tools.json")
assert response.status_code == 200
data = response.json()
assert "tools" in data
assert len(data["tools"]) > 0
# Verify key tools exist
tool_names = [tool["name"] for tool in data["tools"]]
assert "create_issue" in tool_names
assert "list_repos" in tool_names
assert "list_issues" in tool_names
assert "code_feature" in tool_names
def test_setup_completed_endpoint():
"""Test setup check endpoint"""
response = client.get("/setup-completed?uid=test-user")
assert response.status_code == 200
data = response.json()
assert "is_setup_completed" in data
# Should be False for non-existent user
assert data["is_setup_completed"] is False
if __name__ == "__main__":
pytest.main([__file__, "-v"])