Skip to content
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

Feature/group audit updates #326

Merged
merged 23 commits into from
Apr 17, 2023
Merged

Feature/group audit updates #326

merged 23 commits into from
Apr 17, 2023

Conversation

amstilp
Copy link
Contributor

@amstilp amstilp commented Apr 17, 2023

  • Add new factories to construct API responses for group-related queries.
  • Modify the ManagedGroup.anvil_audit method to handle groups that exist in AnVIL but that the app is not part of.

Closes #324

For now, set blank=True so that we can have a data migration to
populate the email field from the group name. (Most groups on
Terra have @firecloud.org as the suffix.)
Since the data migration sets the email for each group, the
ManagedGroup model can now remove blank and add a unique constraint
to the email field.

Note: tests are broken
Also fix a minor bug in the migration itself - it was not lowering
the group name.
For now, add some responses for ManagedGroups. This is intended to
replace the get_api_json_response methods in tests (eventually).
Set the email when creating the object to the default @firecloud.org
email. Use the new api_factory classes in tests and remove the
get_api_json_response method. This still does not handle the case
when a group email is different than the name.
Instead of using get_email() when auditing managed group group
membership, use the group.email field. Add tests to check this.
When creating a managed group on AnVIL, set the email to the default
before saving the object.
Use the email field instead of the (now deprecated) get_email method.
This breaks a LOT of tests and functionality, which will now need
to be updated to use the email field instead of this method.
Add a test is intended to capture the case where a group in the app
is marked as "is_managed_by_app" but the app is not a member of the
group on AnVIL (either as as a member or an admin). With the previous
changes, this would have returned a correct audit, but it was actually
incorrect.
@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

Merging #326 (4040266) into main (2288722) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##             main     #326    +/-   ##
========================================
  Coverage   99.79%   99.79%            
========================================
  Files         107      112     +5     
  Lines       20315    20460   +145     
========================================
+ Hits        20274    20419   +145     
  Misses         41       41            
Impacted Files Coverage Δ
anvil_consortium_manager/tests/settings/test.py 100.00% <ø> (ø)
anvil_consortium_manager/__init__.py 100.00% <100.00%> (ø)
..._manager/migrations/0010_managedgroup_add_email.py 100.00% <100.00%> (ø)
...er/migrations/0011_populate_managed_group_email.py 100.00% <100.00%> (ø)
...nager/migrations/0012_managedgroup_email_unique.py 100.00% <100.00%> (ø)
anvil_consortium_manager/models.py 100.00% <100.00%> (ø)
anvil_consortium_manager/tests/api_factories.py 100.00% <100.00%> (ø)
anvil_consortium_manager/tests/factories.py 100.00% <100.00%> (ø)
anvil_consortium_manager/tests/test_migrations.py 100.00% <100.00%> (ø)
anvil_consortium_manager/tests/test_models.py 98.93% <100.00%> (+<0.01%) ⬆️
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@amstilp amstilp merged commit b7a9c53 into main Apr 17, 2023
@amstilp amstilp deleted the feature/group-audit-updates branch April 17, 2023 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Group audit updates
1 participant