Skip to content

test : added unit tests for _check_field helper in validation - #2342

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

test : added unit tests for _check_field helper in validation#2342
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#2337

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2337.

Summary of What Has Been Done:
Added 20 unit tests for the _check_field helper function in backend/secuscan/validation.py. This private function validates individual input field values against string length and array length limits, and is the core of the validate_task_start_payload function.

Changes Made:

  • New file: testing/backend/unit/test_validation_check_field.py
  • String value tests: at-max-length (pass), exceeding (reject), under-limit (pass), empty (pass)
  • List value tests: at-max-array-length (pass), exceeding (reject), items over limit (reject)
  • Nested dict tests: short values (pass), long string in nested dict (reject with dotted key), long list in nested dict (reject)
  • Non-string/non-list pass-through (int, float, None, bool)
  • Error message safety tests: verifies field names appear but values do not echo back

Impact it Made:

  • Provides granular coverage for the field-level validation logic
  • Ensures string length and array length limits are enforced correctly
  • Guards against regression as settings limits are adjusted

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

@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

Hi, this PR has been waiting for review for a few days now. All CI checks are green. Could you please take a look when you have a moment? Happy to make any adjustments if needed.

@utksh1 utksh1 added level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label area:backend Backend API, database, or service work labels Aug 4, 2026

@utksh1 utksh1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed the focused test change and its current checks are green. The PR still needs a current branch update before merge because it is behind main; I will not bypass the branch policy.

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

Labels

area:backend Backend API, database, or service work level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for _check_field helper in validation

2 participants