Skip to content

Commit ad8f810

Browse files
committed
Revert "Fix tests for FastMCP 3.x: remove .fn() indirection"
This reverts commit 024e747.
1 parent 88b34f1 commit ad8f810

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

tests/test_pvr_mcp.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def fake_gh_api(path, method="GET", body=None):
5151
return {"ghsa_id": "GHSA-1234-5678-abcd", "state": "draft"}, None
5252

5353
with patch.object(self.pvr, "_gh_api", side_effect=fake_gh_api):
54-
result = self.pvr.accept_pvr_advisory(
54+
result = self.pvr.accept_pvr_advisory.fn(
5555
owner="owner",
5656
repo="repo",
5757
ghsa_id="GHSA-1234-5678-abcd",
@@ -73,7 +73,7 @@ def fake_gh_api(path, method="GET", body=None):
7373
return {"ghsa_id": "GHSA-1234-5678-abcd", "state": "closed"}, None
7474

7575
with patch.object(self.pvr, "_gh_api", side_effect=fake_gh_api):
76-
result = self.pvr.reject_pvr_advisory(
76+
result = self.pvr.reject_pvr_advisory.fn(
7777
owner="owner",
7878
repo="repo",
7979
ghsa_id="GHSA-1234-5678-abcd",
@@ -99,7 +99,7 @@ def test_find_similar_reports_matches_vuln_type(self):
9999
)
100100

101101
with _patch_report_dir(report_dir):
102-
result_json = self.pvr.find_similar_triage_reports(
102+
result_json = self.pvr.find_similar_triage_reports.fn(
103103
vuln_type="path traversal",
104104
affected_component="upload handler",
105105
)
@@ -120,7 +120,7 @@ def test_find_similar_reports_no_matches(self):
120120
)
121121

122122
with _patch_report_dir(report_dir):
123-
result_json = self.pvr.find_similar_triage_reports(
123+
result_json = self.pvr.find_similar_triage_reports.fn(
124124
vuln_type="XSS",
125125
affected_component="login form",
126126
)
@@ -132,7 +132,7 @@ def test_find_similar_reports_empty_dir(self):
132132
"""find_similar_triage_reports returns empty list for non-existent REPORT_DIR."""
133133
empty_dir = self.tmp / "nonexistent"
134134
with _patch_report_dir(empty_dir):
135-
result_json = self.pvr.find_similar_triage_reports(
135+
result_json = self.pvr.find_similar_triage_reports.fn(
136136
vuln_type="IDOR",
137137
affected_component="profile",
138138
)
@@ -144,7 +144,7 @@ def test_find_similar_reports_empty_dir(self):
144144
def test_save_triage_report_path_sanitization(self):
145145
"""save_triage_report strips path traversal characters from the GHSA ID."""
146146
with _patch_report_dir(self.tmp):
147-
out_path = self.pvr.save_triage_report(
147+
out_path = self.pvr.save_triage_report.fn(
148148
ghsa_id="../../../etc/passwd",
149149
report="malicious content",
150150
)
@@ -159,7 +159,7 @@ def test_save_triage_report_path_sanitization(self):
159159
def test_save_triage_report_empty_after_sanitization(self):
160160
"""save_triage_report returns an error when ghsa_id is all special chars."""
161161
with _patch_report_dir(self.tmp):
162-
result = self.pvr.save_triage_report(
162+
result = self.pvr.save_triage_report.fn(
163163
ghsa_id="!@#$%^&*()",
164164
report="some content",
165165
)
@@ -173,14 +173,14 @@ def test_read_triage_report_returns_content(self):
173173
(self.tmp / "GHSA-test_triage.md").write_text(content, encoding="utf-8")
174174

175175
with _patch_report_dir(self.tmp):
176-
result = self.pvr.read_triage_report(ghsa_id="GHSA-test")
176+
result = self.pvr.read_triage_report.fn(ghsa_id="GHSA-test")
177177

178178
self.assertEqual(result, content)
179179

180180
def test_read_triage_report_missing_file(self):
181181
"""read_triage_report returns an error string for a missing report."""
182182
with _patch_report_dir(self.tmp):
183-
result = self.pvr.read_triage_report(ghsa_id="GHSA-does-not-exist")
183+
result = self.pvr.read_triage_report.fn(ghsa_id="GHSA-does-not-exist")
184184

185185
self.assertIn("not found", result.lower())
186186

@@ -189,7 +189,7 @@ def test_read_triage_report_missing_file(self):
189189
def test_list_pending_responses_empty(self):
190190
"""list_pending_responses returns [] when no response drafts exist."""
191191
with _patch_report_dir(self.tmp):
192-
result_json = self.pvr.list_pending_responses()
192+
result_json = self.pvr.list_pending_responses.fn()
193193
results = json.loads(result_json)
194194
self.assertEqual(results, [])
195195

@@ -199,7 +199,7 @@ def test_list_pending_responses_returns_pending(self):
199199
"Response draft.", encoding="utf-8"
200200
)
201201
with _patch_report_dir(self.tmp):
202-
result_json = self.pvr.list_pending_responses()
202+
result_json = self.pvr.list_pending_responses.fn()
203203
results = json.loads(result_json)
204204
self.assertEqual(len(results), 1)
205205
self.assertEqual(results[0]["ghsa_id"], "GHSA-1111-2222-3333")
@@ -213,7 +213,7 @@ def test_list_pending_responses_excludes_sent(self):
213213
"Response sent: 2026-03-03T00:00:00+00:00\n", encoding="utf-8"
214214
)
215215
with _patch_report_dir(self.tmp):
216-
result_json = self.pvr.list_pending_responses()
216+
result_json = self.pvr.list_pending_responses.fn()
217217
results = json.loads(result_json)
218218
self.assertEqual(results, [])
219219

@@ -222,7 +222,7 @@ def test_list_pending_responses_excludes_sent(self):
222222
def test_mark_response_sent_creates_marker(self):
223223
"""mark_response_sent creates a _response_sent.md marker and returns its path."""
224224
with _patch_report_dir(self.tmp):
225-
result = self.pvr.mark_response_sent(ghsa_id="GHSA-1111-2222-3333")
225+
result = self.pvr.mark_response_sent.fn(ghsa_id="GHSA-1111-2222-3333")
226226
marker = self.tmp / "GHSA-1111-2222-3333_response_sent.md"
227227
self.assertTrue(marker.exists())
228228
self.assertTrue(result.startswith(str(self.tmp.resolve())))
@@ -232,7 +232,7 @@ def test_mark_response_sent_creates_marker(self):
232232
def test_mark_response_sent_empty_ghsa_id(self):
233233
"""mark_response_sent returns an error string when ghsa_id sanitizes to empty."""
234234
with _patch_report_dir(self.tmp):
235-
result = self.pvr.mark_response_sent(ghsa_id="!@#$%")
235+
result = self.pvr.mark_response_sent.fn(ghsa_id="!@#$%")
236236
self.assertIn("Error", result)
237237

238238
# --- fetch_security_policy ---
@@ -252,7 +252,7 @@ def fake_run(cmd, **kwargs):
252252
return mock_result
253253

254254
with patch("subprocess.run", side_effect=fake_run):
255-
result = self.pvr.fetch_security_policy(owner="acme", repo="widget")
255+
result = self.pvr.fetch_security_policy.fn(owner="acme", repo="widget")
256256

257257
self.assertIn("Security Policy", result)
258258
self.assertIn("Supported Versions", result)
@@ -266,7 +266,7 @@ def fake_run(cmd, **kwargs):
266266
return mock_result
267267

268268
with patch("subprocess.run", side_effect=fake_run):
269-
result = self.pvr.fetch_security_policy(owner="acme", repo="widget")
269+
result = self.pvr.fetch_security_policy.fn(owner="acme", repo="widget")
270270

271271
self.assertEqual(result, "")
272272

@@ -449,7 +449,7 @@ def fake_gh_api(path, method="GET", body=None):
449449
return [], None
450450

451451
with patch.object(self.pvr, "_gh_api", side_effect=fake_gh_api):
452-
result_json = self.pvr.compare_advisories(
452+
result_json = self.pvr.compare_advisories.fn(
453453
owner="owner", repo="repo", state="triage", target_ghsa=""
454454
)
455455

@@ -514,7 +514,7 @@ def fake_gh_api(path, method="GET", body=None):
514514
return fake_advisories, None
515515

516516
with patch.object(self.pvr, "_gh_api", side_effect=fake_gh_api):
517-
result_json = self.pvr.compare_advisories(
517+
result_json = self.pvr.compare_advisories.fn(
518518
owner="owner", repo="repo", state="triage", target_ghsa=""
519519
)
520520

@@ -561,7 +561,7 @@ def fake_gh_api(path, method="GET", body=None):
561561
return fake_advisories, None
562562

563563
with patch.object(self.pvr, "_gh_api", side_effect=fake_gh_api):
564-
result_json = self.pvr.compare_advisories(
564+
result_json = self.pvr.compare_advisories.fn(
565565
owner="owner", repo="repo", state="triage",
566566
target_ghsa="GHSA-aaaa-1111-aaaa",
567567
)

0 commit comments

Comments
 (0)