added validation for deleting membership in individual
Why is this change needed?
Individual is able to remove membership even if the individual is the head of a farm
How was the change implemented?
Added a validation
New unit tests
None
Unit tests executed by the author
None
How to test manually
- Install farmer registry demo module
- Go to Registry -> Farm and create a farm
- Go to Individual and enter the individual record
- Go to Groups tab
- Make sure that the individual is the head of the farmer
- Delete the record in the groups tab then save.
- Check if there is an error.
Related links
https://github.com/OpenSPP/openspp-modules/issues/583
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Codecov Report
Attention: Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
Project coverage is 73.22%. Comparing base (
c2d1b67) to head (ab91df9). Report is 190 commits behind head on 17.0.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...pp_farmer_registry_base/models/group_membership.py | 45.45% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## 17.0 #620 +/- ##
==========================================
- Coverage 73.50% 73.22% -0.29%
==========================================
Files 560 545 -15
Lines 14084 13631 -453
Branches 1799 1751 -48
==========================================
- Hits 10353 9981 -372
+ Misses 3414 3352 -62
+ Partials 317 298 -19
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Verified and working as expected.
Test Steps:
- Install farmer registry demo module
- Go to Registry -> Farm and create a farm
- Go to Individual and enter the individual record
- Go to Groups tab
- Make sure that the individual is the head of the farmer
- Delete the record in the groups tab then save.
- Check if there is an error.
-
Group tab and then delete group vie the delete icon:
-
After group deletion:
-
Error message when trying to exit the individuals tab without a HH head: