Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/test/api/routers/test_decision_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import json
import unittest

from fastapi import HTTPException
from fastapi import FastAPI
from fastapi.testclient import TestClient

from ssvc.api.v1.routers import decision_point
Expand All @@ -29,7 +29,9 @@

class TestDecisionPointAPI(unittest.TestCase):
def setUp(self):
self.client = TestClient(decision_point.router)
app = FastAPI()
app.include_router(decision_point.router)
self.client = TestClient(app)

# create a new registry for testing
self.r = SsvcObjectRegistry(
Expand Down Expand Up @@ -86,8 +88,8 @@ def test_get_decision_point_by_id_success(self):
self.assertEqual(expected, response.json())

def test_get_decision_point_by_id_bad_id(self):
with self.assertRaises(HTTPException):
self.client.get("/decision_point?id=bad_id_format")
response = self.client.get("/decision_point?id=bad_id_format")
self.assertEqual(400, response.status_code)
Comment on lines +91 to +92
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This request path omits the trailing slash for a route declared at @router.get("/") under the /decision_point prefix. The test currently relies on FastAPI/Starlette's redirect-slashes behavior (and the client following redirects), which can make the test brittle. Use /decision_point/?id=bad_id_format to hit the route directly.

Copilot uses AI. Check for mistakes.


if __name__ == "__main__":
Expand Down
10 changes: 6 additions & 4 deletions src/test/api/routers/test_decision_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import json
import unittest

from fastapi import HTTPException
from fastapi import FastAPI
from fastapi.testclient import TestClient

from ssvc.api.v1.routers import decision_table
Expand All @@ -30,7 +30,9 @@

class TestDecisionPointAPI(unittest.TestCase):
def setUp(self):
self.client = TestClient(decision_table.router)
app = FastAPI()
app.include_router(decision_table.router)
self.client = TestClient(app)
Comment on lines 31 to +35
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test class name appears to be copy/pasted: TestDecisionPointAPI in test_decision_table.py is misleading and makes test output harder to interpret. Rename the class to something aligned with the file/router under test (e.g., TestDecisionTableAPI).

Copilot generated this review using guidance from repository custom instructions.

# create a new registry for testing
self.r = SsvcObjectRegistry(
Expand Down Expand Up @@ -110,8 +112,8 @@ def test_get_decision_point_by_id_success(self):
self.assertEqual(expected, response.json())

def test_get_decision_point_by_id_bad_id(self):
with self.assertRaises(HTTPException):
self.client.get("/decision_table?id=bad_id_format")
response = self.client.get("/decision_table?id=bad_id_format")
self.assertEqual(400, response.status_code)
Comment on lines +115 to +116
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This request path omits the trailing slash for a route declared at @router.get("/") under the /decision_table prefix. The test currently relies on FastAPI/Starlette's redirect-slashes behavior (and the client following redirects), which can make the test brittle. Use /decision_table/?id=bad_id_format to hit the route directly.

Copilot uses AI. Check for mistakes.


if __name__ == "__main__":
Expand Down
Loading