Skip to content

[test]: Tests for Loan - #8589

Merged
CarolineDenis merged 22 commits into
mainfrom
issue-8588
Sep 30, 2026
Merged

CarolineDenis merged 22 commits into
mainfrom
issue-8588

Conversation

@rijulpoudel

@rijulpoudel rijulpoudel commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #8588

Summary by CodeRabbit

  • Tests
    • Expanded loan coverage for saving loan details, dates, agents, shipments, preparation relationships, and attachments.
    • Added checks that cloning a loan leaves its preparations with the original, while deleting a loan removes its preparation associations.
    • Added coverage for catalog-number requests that include records with or without preparations, as well as nonexistent identifiers, and verifies availability results when preparations are fully loaned out.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3b2099cd-fea2-4ff5-8547-25775b70203a

📥 Commits

Reviewing files that changed from the base of the PR and between 19069d4 and 05004ef.

📒 Files selected for processing (8)
  • specifyweb/backend/businessrules/tests/test_clone_previously_created.py
  • specifyweb/backend/businessrules/tests/test_delete_previously_created.py
  • specifyweb/backend/businessrules/tests/test_loan.py
  • specifyweb/backend/interactions/tests/test_preps_available_ids.py
  • specifyweb/frontend/js_src/lib/components/BatchEdit/__tests__/BatchEditFromQuery.test.tsx
  • specifyweb/frontend/js_src/lib/components/BatchEdit/__tests__/MissingRanks.test.tsx
  • specifyweb/frontend/js_src/lib/components/BatchEdit/__tests__/missingRanksUtils.test.ts
  • specifyweb/frontend/js_src/lib/components/WbUtils/__tests__/datasetVariants.test.ts
 ________________________________________________
< Press W-A-S-D to move me around your codebase. >
 ------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

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: 611ee34f-ace7-421b-a995-bcedc3895fa5

📥 Commits

Reviewing files that changed from the base of the PR and between 69e04f3 and 19069d4.

📒 Files selected for processing (1)
  • specifyweb/backend/interactions/tests/test_preps_available_ids.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds tests for loan fields, relationships, shipments, and attachments. It also extends clone and deletion tests for loan preparation associations and adds coverage for mixed catalog numbers in the preparations-available endpoint.

Changes

Loan test coverage

Layer / File(s) Summary
Loan creation and stored fields
specifyweb/backend/businessrules/tests/test_loan.py
Tests check loans with and without preparations, loan dates, agent associations, and descriptive and custom fields.
Shipments, relationships, and attachments
specifyweb/backend/businessrules/tests/test_loan.py
Tests check shipment fields and contacts, related-object counts, persisted associations, and attachment creation and deletion.
Loan preparation clone and deletion behavior
specifyweb/backend/businessrules/tests/test_clone_previously_created.py, specifyweb/backend/businessrules/tests/test_delete_previously_created.py
Clone tests check that preparations remain linked to the original loan and are absent from the clone. Deletion tests check that deleting a loan also removes its loan-preparation associations.

Preparation availability test

Layer / File(s) Summary
Mixed catalog number response
specifyweb/backend/interactions/tests/test_preps_available_ids.py
The test posts existing, fully loaned, preparation-free, and nonexistent catalog numbers. It checks the HTTP status and expected response.

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to 19069

The added loan and preparation-availability coverage presents no identified merge-blocking issue.

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Testing Instructions ⚠️ Warning The pull request has no testing instructions. Its description contains only “Fixes #8588”, and the repository template leaves the “Testing instructions” section empty. The pull request changes four ba… Add a Testing instructions section. State the required test environment and provide a command that covers all changed modules, such as ./ve/bin/python manage.py test --verbosity=3 --keepdb from the repository root. Also list the affected …
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the pull request as adding tests for Loan functionality, which matches the main changeset.
Linked Issues check ✅ Passed Issue #8588 requests tests for Loan. The pull request adds automated Loan tests for creation, fields, dates, agents, shipments, preparations, attachments, saving, relationships, cloning, and deletion.…
Out of Scope Changes check ✅ Passed The changes are limited to automated tests. The clone and deletion assertions verify Loan preparation relationships. The preparation-availability test covers Loan-related availability behavior. No unr…
Automatic Tests ✅ Passed The pull request adds automatic tests. The authoritative diff adds 584 lines across four test modules, including 17 new loan tests, clone and delete loan relationship assertions, and a mixed catalog-n…
Full details: Testing Instructions

Explanation

The pull request has no testing instructions. Its description contains only “Fixes #8588”, and the repository template leaves the “Testing instructions” section empty. The pull request changes four backend test modules in the businessrules and interactions components, but it does not state how to run the relevant tests or identify the required backend test scope.

Resolution

Add a Testing instructions section. State the required test environment and provide a command that covers all changed modules, such as ./ve/bin/python manage.py test --verbosity=3 --keepdb from the repository root. Also list the affected targeted tests: specifyweb/backend/businessrules/tests/test_loan.py, test_clone_previously_created.py, test_delete_previously_created.py, and specifyweb/backend/interactions/tests/test_preps_available_ids.py. Mention the MariaDB and Redis prerequisites when the full backend test command requires them.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@CarolineDenis
CarolineDenis merged commit 75a371f into main Sep 30, 2026
19 of 20 checks passed
@CarolineDenis
CarolineDenis deleted the issue-8588 branch September 30, 2026 06:56
@CarolineDenis CarolineDenis added this to the 7.12.2 milestone Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅Done

Development

Successfully merging this pull request may close these issues.

[test]: Tests for Loan

2 participants