Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(workbench): share scan budget cost fixture (#1382)

mldangelo-oai3848edc08934
diff --git a/plugins/codex-security/tests/test_workbench_db.py b/plugins/codex-security/tests/test_workbench_db.py
index ce1bf87e3..bbc11fce1 100644
--- a/plugins/codex-security/tests/test_workbench_db.py
+++ b/plugins/codex-security/tests/test_workbench_db.py
@@ -15,6 +15,7 @@ from typing import Any
import pytest
from workbench_test_support import (
+ BUDGET_COST,
SCRIPT,
begin_deep_scan,
claim_remediation_resend,
@@ -66,14 +67,6 @@ GIT_UNAVAILABLE_WARNING = (
"The scanned Git repository became unavailable while the scan was running; "
"results were saved for the original revision."
)
-BUDGET_COST = {
- "model": "gpt-5.6-sol",
- "inputTokens": 1250,
- "cachedInputTokens": 200,
- "cacheWriteInputTokens": 0,
- "outputTokens": 30,
- "estimatedUsd": 0.00625,
-}
BUDGET_WARNING = "Scan stopped: estimated cost $0.00625 exceeded the $0.005 cost limit."
EXPECTED_TABLES = {
diff --git a/plugins/codex-security/tests/test_workbench_standard_deep_results.py b/plugins/codex-security/tests/test_workbench_standard_deep_results.py
index 947bf8547..254a5b21e 100644
--- a/plugins/codex-security/tests/test_workbench_standard_deep_results.py
+++ b/plugins/codex-security/tests/test_workbench_standard_deep_results.py
@@ -13,6 +13,7 @@ from pathlib import Path
import pytest
from workbench_test_support import (
+ BUDGET_COST,
begin_deep_scan,
cancel_scan,
claim_deep_scan_dedup,
@@ -2149,16 +2150,7 @@ def test_budget_exhaustion_preserves_validated_standard_results_without_candidat
"complete-budget-exhausted-scan",
scan_id,
"--cost-json",
- json.dumps(
- {
- "model": "gpt-5.6-sol",
- "inputTokens": 1250,
- "cachedInputTokens": 200,
- "cacheWriteInputTokens": 0,
- "outputTokens": 30,
- "estimatedUsd": 0.00625,
- }
- ),
+ json.dumps(BUDGET_COST),
"--message",
warning,
)["scan"]
@@ -2198,16 +2190,7 @@ def test_budget_exhaustion_rejects_incomplete_standard_result_draft(tmp_path: Pa
"complete-budget-exhausted-scan",
scan_id,
"--cost-json",
- json.dumps(
- {
- "model": "gpt-5.6-sol",
- "inputTokens": 1250,
- "cachedInputTokens": 200,
- "cacheWriteInputTokens": 0,
- "outputTokens": 30,
- "estimatedUsd": 0.00625,
- }
- ),
+ json.dumps(BUDGET_COST),
check=False,
)
diff --git a/plugins/codex-security/tests/workbench_test_support.py b/plugins/codex-security/tests/workbench_test_support.py
index 6a79568e2..cdb166350 100644
--- a/plugins/codex-security/tests/workbench_test_support.py
+++ b/plugins/codex-security/tests/workbench_test_support.py
@@ -17,6 +17,15 @@ from types import ModuleType
from typing import Any
from unittest import TestCase, mock
+BUDGET_COST = {
+ "model": "gpt-5.6-sol",
+ "inputTokens": 1250,
+ "cachedInputTokens": 200,
+ "cacheWriteInputTokens": 0,
+ "outputTokens": 30,
+ "estimatedUsd": 0.00625,
+}
+
SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "workbench_db.py"
SNAPSHOT_SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "snapshot_sqlite.py"
PLUGIN_MANIFEST = Path(__file__).resolve().parents[1] / ".codex-plugin" / "plugin.json"