Skip to content

[test]: Added tests for gifts - #8493

Open
rijulpoudel wants to merge 12 commits into
mainfrom
issue-8492
Open

[test]: Added tests for gifts#8493
rijulpoudel wants to merge 12 commits into
mainfrom
issue-8492

Conversation

@rijulpoudel

@rijulpoudel rijulpoudel commented Sep 2, 2026

Copy link
Copy Markdown
Member

Fixes #8492

Summary by CodeRabbit

  • Tests
    • Expanded coverage for gift dates and persisted gift details.
    • Added validation for existing and newly created agents linked through shipment relationships.
    • Added coverage for fully populated shipments, including delivery and packaging information.
    • Verified that relationships and field values remain intact after retrieval.
    • Added combined scenarios with multiple agents, preparations, and shipments.
    • Added coverage for completing all gift fields.
    • Added tests for adding and deleting gift attachments.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a6abe4e9-1696-49e9-a340-09884e8c77e0

📥 Commits

Reviewing files that changed from the base of the PR and between 14ac5c0 and 009e346.

📒 Files selected for processing (1)
  • specifyweb/backend/businessrules/tests/test_gift.py

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 75513fb7-397d-4c24-b02a-ce8fb0d65fcc

📥 Commits

Reviewing files that changed from the base of the PR and between 19a992c and 009e346.

📒 Files selected for processing (1)
  • specifyweb/backend/businessrules/tests/test_gift.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds tests for gift fields, agent relationships, preparation links, shipment persistence, and attachment lifecycle behavior after database retrieval.

Changes

Gift test coverage

Layer / File(s) Summary
Gift and agent relationship tests
specifyweb/backend/businessrules/tests/test_gift.py
Adds tests for gift number, gift date, discipline, and Giftagent relationships. Covers existing agents and newly created agents.
Gift shipment persistence test
specifyweb/backend/businessrules/tests/test_gift.py
Adds tests for fully populated shipments and existing or newly created shippedby and shippedto agents. Verifies persisted shipment fields and relationships.
Combined gift persistence test
specifyweb/backend/businessrules/tests/test_gift.py
Adds an integrated test with multiple agents, preparations, quantities, and shipments. Verifies persisted counts, roles, quantities, and shipment numbers.
Gift fields and attachment tests
specifyweb/backend/businessrules/tests/test_gift.py
Adds coverage for remaining gift fields and for creating, retrieving, and deleting Giftattachment and Attachment records.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to 009e3

This change adds persistence and attachment lifecycle coverage without introducing an identified runtime risk.

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Testing Instructions ⚠️ Warning The testing instructions are not clear. The pull request description contains only “Fixes #8492” and gives no test command, setup requirement, or expected result. The diff adds tests in `specifyweb/ba… Add a Testing section to the pull request description. State the required Django test environment, provide the command pytest specifyweb/backend/businessrules/tests/test_gift.py, and list the covered Gift fields, agents, shipments, prepar…
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #8492 requests tests for Gifts. The PR adds gift tests for dates, remaining gift fields, gift agents, preparations, shipments, shipped-by and shipped-to agents, and gift attachment creation and …
Out of Scope Changes check ✅ Passed The PR changes only specifyweb/backend/businessrules/tests/test_gift.py. The added tests directly support issue #8492. No unrelated production or feature changes appear in the reviewed diff.
Automatic Tests ✅ Passed PASS: The PR adds automatic tests in the existing discoverable GiftTests test class. The authoritative diff changes only specifyweb/backend/businessrules/tests/test_gift.py and adds 12 test_...
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding gift tests.
Full details: Testing Instructions

Explanation

The testing instructions are not clear. The pull request description contains only “Fixes #8492” and gives no test command, setup requirement, or expected result. The diff adds tests in specifyweb/backend/businessrules/tests/test_gift.py for Gift, Giftagent, Agent, Shipment, Giftpreparation, Attachment, and Giftattachment, including attachment deletion. The repository provides pytest and pytest-django configuration, but the pull request does not identify how to run this affected test scope.

Resolution

Add a Testing section to the pull request description. State the required Django test environment, provide the command pytest specifyweb/backend/businessrules/tests/test_gift.py, and list the covered Gift fields, agents, shipments, preparations, and attachment add/delete behavior. State the expected result: all tests pass.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8492

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rijulpoudel

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rijulpoudel

Copy link
Copy Markdown
Member Author

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 54 minutes.

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

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

[test]: Add tests for Gifts

1 participant