Skip to content

Fix three failing CxOne test suites - #226

Merged
cx-happy-yang merged 3 commits into
masterfrom
fix/cxone-test-bugs
Sep 9, 2026
Merged

cx-happy-yang merged 3 commits into
masterfrom
fix/cxone-test-bugs

Conversation

@cx-happy-yang

Copy link
Copy Markdown
Contributor
  • test_dast_results_api: import get_results from dastResultsAPI directly. The name exported by CheckmarxPythonSDK.CxOne resolves to riskManagementAPI.get_results (different endpoint and signature) because that import comes later in CxOne/init.py.
  • dastScanAPI.run_scan: read upload files fully and pass bytes to httpx instead of open handles. httpx does not close caller-owned file objects, which leaked the handle and made os.unlink fail with WinError 32 on Windows.
  • test_versions_api: assert the SAST version matches a semver shape instead of hardcoding 9.7.4; the server upgrades on its own schedule.

- test_dast_results_api: import get_results from dastResultsAPI directly.
  The name exported by CheckmarxPythonSDK.CxOne resolves to
  riskManagementAPI.get_results (different endpoint and signature) because
  that import comes later in CxOne/__init__.py.
- dastScanAPI.run_scan: read upload files fully and pass bytes to httpx
  instead of open handles. httpx does not close caller-owned file objects,
  which leaked the handle and made os.unlink fail with WinError 32 on
  Windows.
- test_versions_api: assert the SAST version matches a semver shape instead
  of hardcoding 9.7.4; the server upgrades on its own schedule.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@cx-happy-yang cx-happy-yang added the workflows-approved A PR needs the label workflows-approved to run any workflows. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details – 670edcf1-abd1-488e-b686-0c9de973e931

Great job! No new security vulnerabilities introduced in this pull request

@cx-james-bostock

Copy link
Copy Markdown
Contributor

Hi @cx-happy-yang,
Wouldn't it make more sense to rename the get_results method and function in the dastResultsAPI.py file to avoid the naming collision? I can see this tripping up users of the SDK. Checking the __init__.py file, I see that there are a few more cases:

$ sort __init__.py | uniq -d

    create_byor_import,
    get_all_queries,
    get_results,
    get_the_logs_associated_to_the_audit_session,
)

@cx-happy-yang

Copy link
Copy Markdown
Contributor Author

@cx-james-bostock .

Make sense. Let me check.

cx-happy-yang and others added 2 commits September 9, 2026 08:53
Four names in CxOne/__init__.py were exported by two different API modules, so the later import silently shadowed the earlier one and the package-level name resolved to the wrong endpoint:

- dastResultsAPI.get_results -> dast_get_results (riskManagementAPI keeps get_results)
- byorResultsHandlerAPI.create_byor_import -> create_byor_import_v1 (v2 keeps create_byor_import)
- queryEditorAPI.get_all_queries -> get_query_editor_queries
- queryEditorAPI.get_the_logs_associated_to_the_audit_session -> get_query_editor_session_logs
  (sastQueriesAuditAPI keeps its plain names)

Breaking change: the renamed class methods and module-level functions are no longer available under their old names. Tests and docs updated accordingly.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>

@cx-james-bostock cx-james-bostock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @cx-happy-yang,
Looks good to me.

@cx-happy-yang
cx-happy-yang merged commit e59df2c into master Sep 9, 2026
8 of 9 checks passed
@cx-happy-yang
cx-happy-yang deleted the fix/cxone-test-bugs branch September 9, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workflows-approved A PR needs the label workflows-approved to run any workflows.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants