-
Notifications
You must be signed in to change notification settings - Fork 31
Fixes #47 [Housekeeping]: Develop Plugin Tests - Models #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Fixes #47 [Housekeeping]: Develop Plugin Tests - Models #257
Conversation
Note: This is a draft PR. I rebased the work by @ryanmerolle from PR #134, cleaned up the codebase, and added additional tests. I'll be adding tests for ACLStandardRule and ACLExtendedRule in the coming days. |
dc69c16
to
a872eea
Compare
I included a fix for Bug #258, as it was necessary to properly test the uniqueness of Interface and Direction. Additionally, I cleaned up the model files I appreciate your time reviewing all these changes. Thank you, @cruse1977 ! |
a872eea
to
78dbba8
Compare
Hi @cruse1977, Thank you again for taking the time to review this PR. I wanted to mention that I’m happy to break out some of the enhancements and housekeeping changes (such as the i18n additions and the model file cleanups) into separate issues or pull requests if that would help streamline the review process or better align with the project's contribution practices. Please let me know what you prefer, and I’ll adjust accordingly. Thanks again for your guidance and support! |
Renames `test_models.py` to `models/test_accesslists.py` to improve test organization and maintainability. This is a structural change with no modifications to test logic.
Refactor test setup to improve data creation and reusability. Add detailed fixtures for devices, virtual chassis, clusters, virtual machines, and prefixes. Update all assignments to reference the new fixtures for better consistency.
Add test cases to validate AccessList creation and uniqueness for VirtualChassis and VirtualMachine objects. Extend coverage by ensuring proper handling of duplicate names and enforcing unique constraints.
Move validation to the `save` method to enforce that the assigned interface's host matches the access list's host before saving. This replaces validation in the `clean` method for better data integrity enforcement.
Improve test coverage for ACLInterfaceAssignment validation. Add tests for valid and invalid direction choices, duplicate assignments, and missing host assignments to ensure robust validation logic.
Moves ACL rule validation logic from forms to model methods to ensure consistent enforcement across all usages. This improves maintainability and eliminates redundant validation code.
Adds comprehensive tests for the ACLStandardRule model. Tests cover rule creation scenarios, validation constraints, and edge cases, ensuring thorough model behavior validation. Fixes netbox-community#47
Introduces comprehensive test cases for the ACLExtendedRule model. These cover rule creation, validation, and edge cases such as duplicate indices and invalid combinations of parameters. Fixes netbox-community#47
eb4723a
to
3fa1506
Compare
Hi @cruse1977, Quick update on this PR:
One note: the following commit is still part of this PR:
These changes are necessary for the tests to pass. I'm happy to extract this into its own issue and PR if you prefer, but in that case, this models test PR would need to wait for those changes to be merged first. Let me know how you’d like to proceed. Thanks again for your feedback and support! |
Pull Request
Related Issue
Fixes: #47 [Housekeeping] Develop Plugin Tests - Models
New Behavior
Contrast to Current Behavior
Discussion: Benefits and Drawbacks
Changes to the Documentation
Proposed Release Note Entry
Attribution
Some of the code in this PR is based on previous work by @ryanmerolle in PR #134.
Double Check
or in a linked issue.
dev
branch.