[PR #15369] [MERGED] Closes #15237: Add tests for missing filters #14578

Closed
opened 2025-12-29 23:25:18 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/15369
Author: @jeremystretch
Created: 3/7/2024
Status: Merged
Merged: 3/12/2024
Merged by: @jeremystretch

Base: featureHead: 15237-audit-filtersets


📝 Commits (10+)

  • 6af12b1 Add tests for missing FilterSet filters
  • 16b422c Add missing filters
  • 5cb7af8 Fix remaining tests
  • 0a0dae3 Inspect many-to-many fields
  • 6085e0b Test for missing ManyToManyField filters
  • b36a70d Add missing filters for reverse many-to-many relationships
  • a136030 Validate filter class for foreign key fields
  • 313e636 Extend logic for validating filter class
  • f8744a6 Clean up exemption logic
  • bea32ae Declare FilterSet fields as a tuple

📊 Changes

22 files changed (+918 additions, -239 deletions)

View changed files

📝 netbox/circuits/filtersets.py (+23 -6)
📝 netbox/circuits/tests/test_filtersets.py (+1 -0)
📝 netbox/core/filtersets.py (+3 -5)
📝 netbox/core/tests/test_filtersets.py (+2 -0)
📝 netbox/dcim/filtersets.py (+159 -64)
📝 netbox/dcim/forms/filtersets.py (+1 -1)
📝 netbox/dcim/tests/test_filtersets.py (+32 -15)
📝 netbox/extras/filtersets.py (+65 -50)
📝 netbox/extras/tests/test_filtersets.py (+107 -16)
📝 netbox/ipam/filtersets.py (+74 -22)
📝 netbox/ipam/forms/filtersets.py (+1 -1)
📝 netbox/ipam/tests/test_filtersets.py (+91 -10)
📝 netbox/tenancy/filtersets.py (+6 -6)
📝 netbox/users/filtersets.py (+31 -4)
📝 netbox/users/tests/test_filtersets.py (+49 -0)
📝 netbox/utilities/testing/filtersets.py (+132 -1)
📝 netbox/virtualization/filtersets.py (+6 -6)
📝 netbox/virtualization/tests/test_filtersets.py (+1 -0)
📝 netbox/vpn/filtersets.py (+54 -18)
📝 netbox/vpn/tests/test_filtersets.py (+50 -9)

...and 2 more files

📄 Description

Fixes: #15237

  • Introduces the test_missing_filters() method on BaseFilterSetTests, which check that all relevant model fields have the appropriate filter(s) defined on the model's filter set.
  • Implements the missing filters identified by the new tests
  • Add functional tests for the new filters

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/15369 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 3/7/2024 **Status:** ✅ Merged **Merged:** 3/12/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `15237-audit-filtersets` --- ### 📝 Commits (10+) - [`6af12b1`](https://github.com/netbox-community/netbox/commit/6af12b18148d21f522591966862fb1faab4f6ac2) Add tests for missing FilterSet filters - [`16b422c`](https://github.com/netbox-community/netbox/commit/16b422cbacb907649e19e21ff031294233e31552) Add missing filters - [`5cb7af8`](https://github.com/netbox-community/netbox/commit/5cb7af88d4e9150a0d3516c624f27d63b1553f22) Fix remaining tests - [`0a0dae3`](https://github.com/netbox-community/netbox/commit/0a0dae3d355cf46bd36621cd4221ec5538a7d150) Inspect many-to-many fields - [`6085e0b`](https://github.com/netbox-community/netbox/commit/6085e0bb0bdefc3c7bc7e586607bee4699f2ea03) Test for missing ManyToManyField filters - [`b36a70d`](https://github.com/netbox-community/netbox/commit/b36a70d23664839eec0e4ad8428e9c138e978b56) Add missing filters for reverse many-to-many relationships - [`a136030`](https://github.com/netbox-community/netbox/commit/a136030094dbff6baa45accfa815b10b505a79d2) Validate filter class for foreign key fields - [`313e636`](https://github.com/netbox-community/netbox/commit/313e63622b019b34757db6369ea684c8e28113b8) Extend logic for validating filter class - [`f8744a6`](https://github.com/netbox-community/netbox/commit/f8744a665918fdd3a8764d4b7d36f5e3256bbc06) Clean up exemption logic - [`bea32ae`](https://github.com/netbox-community/netbox/commit/bea32aef71d69a188acdbfa095e18e1c62d40a70) Declare FilterSet fields as a tuple ### 📊 Changes **22 files changed** (+918 additions, -239 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/filtersets.py` (+23 -6) 📝 `netbox/circuits/tests/test_filtersets.py` (+1 -0) 📝 `netbox/core/filtersets.py` (+3 -5) 📝 `netbox/core/tests/test_filtersets.py` (+2 -0) 📝 `netbox/dcim/filtersets.py` (+159 -64) 📝 `netbox/dcim/forms/filtersets.py` (+1 -1) 📝 `netbox/dcim/tests/test_filtersets.py` (+32 -15) 📝 `netbox/extras/filtersets.py` (+65 -50) 📝 `netbox/extras/tests/test_filtersets.py` (+107 -16) 📝 `netbox/ipam/filtersets.py` (+74 -22) 📝 `netbox/ipam/forms/filtersets.py` (+1 -1) 📝 `netbox/ipam/tests/test_filtersets.py` (+91 -10) 📝 `netbox/tenancy/filtersets.py` (+6 -6) 📝 `netbox/users/filtersets.py` (+31 -4) 📝 `netbox/users/tests/test_filtersets.py` (+49 -0) 📝 `netbox/utilities/testing/filtersets.py` (+132 -1) 📝 `netbox/virtualization/filtersets.py` (+6 -6) 📝 `netbox/virtualization/tests/test_filtersets.py` (+1 -0) 📝 `netbox/vpn/filtersets.py` (+54 -18) 📝 `netbox/vpn/tests/test_filtersets.py` (+50 -9) _...and 2 more files_ </details> ### 📄 Description ### Fixes: #15237 - Introduces the `test_missing_filters()` method on `BaseFilterSetTests`, which check that all relevant model fields have the appropriate filter(s) defined on the model's filter set. - Implements the missing filters identified by the new tests - Add functional tests for the new filters --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:25:18 +01:00
adam closed this issue 2025-12-29 23:25:18 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14578