Skip to content

test : added unit tests for routes JSON deserialization helpers#1079

Open
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#1065
Open

test : added unit tests for routes JSON deserialization helpers#1079
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#1065

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1065.

Summary of What Has Been Done:
Added testing/backend/unit/test_routes_json_helpers.py covering the three pure helper functions exported by backend.secuscan.routes_json_helpers. The module was extracted from routes.py in a prior merge; these tests directly import and exercise the real production functions. 14 tests, all passing.

Changes Made:

  • Created testing/backend/unit/test_routes_json_helpers.py
  • parse_json_fields: parses JSON string fields, preserves non-string/falsy fields, keeps original string on decode error, does not mutate input
  • deserialize_finding_rows: strips *_json suffix and renames to friendly keys (metadata_json -> metadata), partial fields only rename present keys, does not mutate input
  • deserialize_asset_service_rows: parses and renames metadata_json and cert_san_json, ignores unknown *_json fields, does not mutate input
  • FINDING_JSON_FIELDS constant: verified to contain the expected six field names

Impact it Made:
Zero test coverage for the routes JSON deserialization helpers. These functions run on every finding and asset-service row returned from the database; untested, a regression in the JSON parsing or renaming logic could silently corrupt or drop finding data in the API responses.

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for routes JSON deserialization helpers

1 participant