Skip to content

test : added unit tests for risk_scoring _recency_detail helper#2077

Closed
tmdeveloper007 wants to merge 3 commits into
utksh1:mainfrom
tmdeveloper007:#2072
Closed

test : added unit tests for risk_scoring _recency_detail helper#2077
tmdeveloper007 wants to merge 3 commits into
utksh1:mainfrom
tmdeveloper007:#2072

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2072.

Summary of What Has Been Done:

Added testing/backend/unit/test_risk_scoring_recency_detail.py with 6 unit tests covering _recency_detail in backend/secuscan/risk_scoring.py.

Changes Made:

  • None discovered_at: returns "No discovery date — assumed moderate recency"
  • Future date: returns "Discovered in the future — treated as very recent"
  • Today: returns "Discovered today — maximum recency score"
  • Yesterday (1 day ago): contains "1 day ago" and the score value
  • Multiple days ago: contains correct day count and score
  • Naive datetime: gets UTC tzinfo applied correctly

Tests pass with python3 -m pytest --noconftest.

Impact it Made:

  • Ensures risk factor detail strings are correct for audit/reporting
  • Catches bugs in datetime timezone handling

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

@utksh1

utksh1 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Closing as superseded by #2079, whose branch already contains this commit. Please avoid stacked duplicate PRs; keep one focused branch per reviewable change.

@utksh1 utksh1 closed this Jul 24, 2026
@utksh1 utksh1 added the gssoc:invalid Admin validation: invalid for GSSoC scoring label Jul 24, 2026
@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 Jul 24, 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.

This PR is stacked on earlier unrelated test branches and removes existing recency coverage. Please rebase independently, preserve existing tests, retain only focused _recency_detail cases, and fix backend-unit before re-review.

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 gssoc:invalid Admin validation: invalid for GSSoC scoring 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 _recency_detail helper in risk_scoring

2 participants