Skip to content

[ELUSoC'26] Add coverage for expired tokens and invalid expiry values - #200

Closed
Shikha18Shukla wants to merge 3 commits into
Him-an-shi:mainfrom
Shikha18Shukla:issue-166-share-tests
Closed

[ELUSoC'26] Add coverage for expired tokens and invalid expiry values#200
Shikha18Shukla wants to merge 3 commits into
Him-an-shi:mainfrom
Shikha18Shukla:issue-166-share-tests

Conversation

@Shikha18Shukla

Copy link
Copy Markdown
Contributor

🔗 Linked Issue

Closes #166


📝 Summary

Added missing test coverage for share link lifecycle validation in backend/tests/test_sharing.py.

This PR improves the robustness of the sharing feature by adding tests for expired share tokens and invalid expiry inputs. The added test cases ensure that invalid requests are properly rejected and expired links cannot be accessed.


🔧 Changes Made

Added the following test cases:

test_view_shared_data_expired

  • Added coverage for naturally expired share links.
  • Verifies that expired tokens cannot be used to access shared cycle data.
  • Ensures the endpoint returns the expected rejection status.

test_create_share_link_negative_expiry

  • Added validation coverage for negative expiresInDays values.
  • Ensures requests with invalid negative expiry values return 400 Bad Request.

test_create_share_link_invalid_type_expiry

  • Added validation coverage for non-integer expiry values.
  • Ensures malformed expiry inputs such as strings are rejected with 400 Bad Request.

These tests extend the existing sharing test suite by covering important edge cases around token expiration and input validation.


📸 Screenshots (if UI changed)

Not applicable.

This PR only modifies backend tests and does not include any UI changes.


🧪 Testing Performed

Share Link Test Suite

Command:

pytest tests/test_sharing.py -v

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Shikha18Shukla is attempting to deploy a commit to the himanshipathak-240263-3015's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Him-an-shi Him-an-shi 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.

Hi! @Shikha18Shukla Please resolve merge issues

@Shikha18Shukla

Copy link
Copy Markdown
Contributor Author

Hi @Him-an-shi , I checked the PR and GitHub shows there are no merge conflicts with the base branch. The failing PR Quality Check appears to stop at the actions/checkout step because the workflow is triggered with pull_request_target on a forked PR, and Vercel is also waiting for repository authorization. Could you please confirm if there's anything else you'd like me to update in the PR? If there's a specific merge issue on my side, I'd be happy to fix it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(share): missing coverage for expired tokens and negative expiry values

2 participants