diff --git a/primed/cdsa/audit/accessor_audit.py b/primed/cdsa/audit/accessor_audit.py index 9fdeedaa..7c50c00c 100644 --- a/primed/cdsa/audit/accessor_audit.py +++ b/primed/cdsa/audit/accessor_audit.py @@ -94,8 +94,8 @@ class Error(AccessorAuditResult): pass -class SignedAgreementAccessorAuditTable(tables.Table): - """A table to show results from a SignedAgreementAccessorAudit subclass.""" +class AccessorAuditTable(tables.Table): + """A table to show results from a AccessorAudit subclass.""" signed_agreement = tables.Column(linkify=True) user = tables.Column(linkify=True) @@ -108,7 +108,7 @@ class Meta: attrs = {"class": "table align-middle"} -class SignedAgreementAccessorAudit(PRIMEDAudit): +class AccessorAudit(PRIMEDAudit): """Audit collaborators for a SignedAgreement.""" # Access verified. @@ -127,7 +127,7 @@ class SignedAgreementAccessorAudit(PRIMEDAudit): UNEXPECTED_GROUP_ACCESS = "Group should not have access." ACCOUNT_NOT_LINKED_TO_USER = "Account is not linked to a user." - results_table_class = SignedAgreementAccessorAuditTable + results_table_class = AccessorAuditTable def __init__(self, queryset=None): super().__init__() diff --git a/primed/cdsa/audit/uploader_audit.py b/primed/cdsa/audit/uploader_audit.py index bda46bd3..7b379fa6 100644 --- a/primed/cdsa/audit/uploader_audit.py +++ b/primed/cdsa/audit/uploader_audit.py @@ -100,7 +100,7 @@ class Error(UploaderAuditResult): pass -class DataAffiliateUploaderAuditTable(tables.Table): +class UploaderAuditTable(tables.Table): """A table to show results from a DataAffiliateAgreementUploaderAudit subclass.""" data_affiliate_agreement = tables.Column(linkify=True) @@ -114,7 +114,7 @@ class Meta: attrs = {"class": "table align-middle"} -class DataAffiliateUploaderAudit(PRIMEDAudit): +class UploaderAudit(PRIMEDAudit): """Audit collaborators for a DataAffiliateAgreement.""" # Access verified. @@ -133,7 +133,7 @@ class DataAffiliateUploaderAudit(PRIMEDAudit): UNEXPECTED_GROUP_ACCESS = "Group should not have access." ACCOUNT_NOT_LINKED_TO_USER = "Account is not linked to a user." - results_table_class = DataAffiliateUploaderAuditTable + results_table_class = UploaderAuditTable def __init__(self, queryset=None): super().__init__() diff --git a/primed/cdsa/tests/test_audit.py b/primed/cdsa/tests/test_audit.py index d9647a92..c2b37a2c 100644 --- a/primed/cdsa/tests/test_audit.py +++ b/primed/cdsa/tests/test_audit.py @@ -2138,12 +2138,12 @@ def test_error(self): class AccessorAuditTableTest(TestCase): - """Tests for the `SignedAgreementAccessorAuditTable` table.""" + """Tests for the `AccessorAuditTable` table.""" def test_no_rows(self): """Table works with no rows.""" - table = accessor_audit.SignedAgreementAccessorAuditTable([]) - self.assertIsInstance(table, accessor_audit.SignedAgreementAccessorAuditTable) + table = accessor_audit.AccessorAuditTable([]) + self.assertIsInstance(table, accessor_audit.AccessorAuditTable) self.assertEqual(len(table.rows), 0) def test_one_row(self): @@ -2159,8 +2159,8 @@ def test_one_row(self): "note": "a note", } ] - table = accessor_audit.SignedAgreementAccessorAuditTable(data) - self.assertIsInstance(table, accessor_audit.SignedAgreementAccessorAuditTable) + table = accessor_audit.AccessorAuditTable(data) + self.assertIsInstance(table, accessor_audit.AccessorAuditTable) self.assertEqual(len(table.rows), 1) self.assertIn( str(member_agreement.signed_agreement.cc_id), @@ -2190,8 +2190,8 @@ def test_two_rows(self): "note": "note 2", }, ] - table = accessor_audit.SignedAgreementAccessorAuditTable(data) - self.assertIsInstance(table, accessor_audit.SignedAgreementAccessorAuditTable) + table = accessor_audit.AccessorAuditTable(data) + self.assertIsInstance(table, accessor_audit.AccessorAuditTable) self.assertEqual(len(table.rows), 2) self.assertIn( str(member_agreement_1.signed_agreement.cc_id), @@ -2265,12 +2265,12 @@ def test_error(self): class UploaderAuditTableTest(TestCase): - """Tests for the `DataAffiliateUploaderAuditTable` table.""" + """Tests for the `UploaderAuditTable` table.""" def test_no_rows(self): """Table works with no rows.""" - table = uploader_audit.DataAffiliateUploaderAuditTable([]) - self.assertIsInstance(table, uploader_audit.DataAffiliateUploaderAuditTable) + table = uploader_audit.UploaderAuditTable([]) + self.assertIsInstance(table, uploader_audit.UploaderAuditTable) self.assertEqual(len(table.rows), 0) def test_one_row(self): @@ -2286,8 +2286,8 @@ def test_one_row(self): "note": "a note", } ] - table = uploader_audit.DataAffiliateUploaderAuditTable(data) - self.assertIsInstance(table, uploader_audit.DataAffiliateUploaderAuditTable) + table = uploader_audit.UploaderAuditTable(data) + self.assertIsInstance(table, uploader_audit.UploaderAuditTable) self.assertEqual(len(table.rows), 1) self.assertIn( str(data_affiliate_agreement.signed_agreement.cc_id), @@ -2317,8 +2317,8 @@ def test_two_rows(self): "note": "note 2", }, ] - table = uploader_audit.DataAffiliateUploaderAuditTable(data) - self.assertIsInstance(table, uploader_audit.DataAffiliateUploaderAuditTable) + table = uploader_audit.UploaderAuditTable(data) + self.assertIsInstance(table, uploader_audit.UploaderAuditTable) self.assertEqual(len(table.rows), 2) self.assertIn( str(data_affiliate_agreement_1.signed_agreement.cc_id), @@ -2332,19 +2332,19 @@ def test_two_rows(self): self.assertEqual(table.rows[1].get_cell("note"), "note 2") -class SignedAgreementAccessorAuditTest(TestCase): - """Tests for the SignedAgreementAccessorAudit classes.""" +class AccessorAuditTest(TestCase): + """Tests for the AccessorAudit classes.""" def test_completed(self): """completed is updated properly.""" - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() self.assertFalse(audit.completed) audit.run_audit() self.assertTrue(audit.completed) def test_no_applications(self): """Audit works if there are no SignedAgreements.""" - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.run_audit() self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -2354,7 +2354,7 @@ def test_audit_agreement_and_object_user(self): """audit_agreement_and_object works when passed a user object.""" signed_agreement = factories.SignedAgreementFactory.create() user = UserFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, user) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2364,13 +2364,13 @@ def test_audit_agreement_and_object_user(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(record.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) def test_audit_agreement_and_object_account(self): """audit_agreement_and_object works when passed an Account object.""" signed_agreement = factories.SignedAgreementFactory.create() account = AccountFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, account) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2380,13 +2380,13 @@ def test_audit_agreement_and_object_account(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_group(self): """audit_agreement_and_object works when passed a ManagedGroup object.""" signed_agreement = factories.SignedAgreementFactory.create() group = ManagedGroupFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, group) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2396,13 +2396,13 @@ def test_audit_agreement_and_object_group(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, accessor_audit.AccessorAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_user_email(self): """audit_agreement_and_object works when passed a string email for a user.""" signed_agreement = factories.SignedAgreementFactory.create() user = UserFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, user.username) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2412,13 +2412,13 @@ def test_audit_agreement_and_object_user_email(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(record.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) def test_audit_agreement_and_object_user_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for a user.""" signed_agreement = factories.SignedAgreementFactory.create() user = UserFactory.create(username="foo@BAR.com") - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2428,13 +2428,13 @@ def test_audit_agreement_and_object_user_email_case_insensitive(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(record.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) def test_audit_agreement_and_object_account_email(self): """audit_agreement_and_object works when passed a string email for an account.""" signed_agreement = factories.SignedAgreementFactory.create() account = AccountFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, account.email) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2444,13 +2444,13 @@ def test_audit_agreement_and_object_account_email(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_account_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for an account.""" signed_agreement = factories.SignedAgreementFactory.create() account = AccountFactory.create(email="foo@BAR.com") - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2460,13 +2460,13 @@ def test_audit_agreement_and_object_account_email_case_insensitive(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_group_email(self): """audit_agreement_and_object works when passed a string email for a ManagedGroup.""" signed_agreement = factories.SignedAgreementFactory.create() group = ManagedGroupFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, group.email) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2476,13 +2476,13 @@ def test_audit_agreement_and_object_group_email(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, accessor_audit.AccessorAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_group_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for a ManagedGroup.""" signed_agreement = factories.SignedAgreementFactory.create() group = ManagedGroupFactory.create(email="foo@BAR.com") - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2492,12 +2492,12 @@ def test_audit_agreement_and_object_group_email_case_insensitive(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, accessor_audit.AccessorAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_email_does_not_exist(self): """audit_agreement_and_object works when passed a ManagedGroup object.""" signed_agreement = factories.SignedAgreementFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() with self.assertRaises(ValueError) as e: audit.audit_agreement_and_object(signed_agreement, "foo@bar.com") self.assertIn( @@ -2508,7 +2508,7 @@ def test_audit_agreement_and_object_email_does_not_exist(self): def test_audit_agreement_and_object_other_object(self): """audit_agreement_and_object raises ValueError when passed an incorrect object.""" signed_agreement = factories.SignedAgreementFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() with self.assertRaises(ValueError): audit.audit_agreement_and_object(signed_agreement, object) @@ -2522,7 +2522,7 @@ def test_accessor_linked_account_in_access_group(self): # Access group membership. GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 1) @@ -2533,7 +2533,7 @@ def test_accessor_linked_account_in_access_group(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_IN_ACCESS_GROUP) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_IN_ACCESS_GROUP) def test_accessor_linked_account_not_in_access_group(self): # Create applications. @@ -2545,7 +2545,7 @@ def test_accessor_linked_account_not_in_access_group(self): # Access group membership. # GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) @@ -2556,7 +2556,7 @@ def test_accessor_linked_account_not_in_access_group(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT) def test_accessor_no_account(self): # Create applications. @@ -2569,7 +2569,7 @@ def test_accessor_no_account(self): # Access group membership. # GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 1) @@ -2580,7 +2580,7 @@ def test_accessor_no_account(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_NO_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_NO_ACCOUNT) def test_user_in_group_not_accessor(self): # Create applications. @@ -2592,7 +2592,7 @@ def test_user_in_group_not_accessor(self): # Access group membership. GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) @@ -2603,7 +2603,7 @@ def test_user_in_group_not_accessor(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(record.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) def test_not_accessor_and_account_has_no_user(self): # Create applications. @@ -2615,7 +2615,7 @@ def test_not_accessor_and_account_has_no_user(self): # Access group membership. GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) @@ -2626,7 +2626,7 @@ def test_not_accessor_and_account_has_no_user(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_two_accessors(self): """Audit works when there are two accessors.""" @@ -2640,7 +2640,7 @@ def test_two_accessors(self): # Access group membership. GroupAccountMembershipFactory.create(group=signed_agreement.anvil_access_group, account=account_1) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 1) # One of the accessors. @@ -2657,7 +2657,7 @@ def test_two_accessors(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, account_2.user) self.assertEqual(record.member, account_2) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT) def test_unexpected_group_in_access_group(self): """A group unexpectedly has access.""" @@ -2670,7 +2670,7 @@ def test_unexpected_group_in_access_group(self): child_group=group, ) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) @@ -2681,13 +2681,13 @@ def test_unexpected_group_in_access_group(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.UNEXPECTED_GROUP_ACCESS) + self.assertEqual(record.note, accessor_audit.AccessorAudit.UNEXPECTED_GROUP_ACCESS) def test_representative_not_accessor(self): """Representative is not an accessor.""" # Create applications. signed_agreement = factories.SignedAgreementFactory.create() - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) @@ -2699,7 +2699,7 @@ def test_representative_is_accessor(self): # Create applications. signed_agreement = factories.SignedAgreementFactory.create() signed_agreement.accessors.add(signed_agreement.representative) - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 1) @@ -2710,7 +2710,7 @@ def test_representative_is_accessor(self): self.assertEqual(record.signed_agreement, signed_agreement) self.assertEqual(record.user, signed_agreement.representative) self.assertIsNone(record.member) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_NO_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_NO_ACCOUNT) def test_ignores_admins_group(self): """Ignores the admin group.""" @@ -2723,14 +2723,14 @@ def test_ignores_admins_group(self): child_group=group, ) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) self.assertEqual(len(audit.errors), 0) # Check the sub-method specifically. - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, group) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -2748,14 +2748,14 @@ def test_ignores_admins_group_different_setting(self): child_group=group, ) # Set up audit - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() # Run audit audit.audit_agreement(signed_agreement) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) self.assertEqual(len(audit.errors), 0) # Check the sub-method specifically. - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.audit_agreement_and_object(signed_agreement, group) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -2769,7 +2769,7 @@ def test_two_agreements(self): signed_agreement_2 = factories.SignedAgreementFactory.create() user_2 = UserFactory.create() signed_agreement_2.accessors.add(user_2) - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.run_audit() self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 1) @@ -2779,13 +2779,13 @@ def test_two_agreements(self): self.assertEqual(record.signed_agreement, signed_agreement_2) self.assertEqual(record.user, user_2) self.assertEqual(record.member, None) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_NO_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_NO_ACCOUNT) record = audit.needs_action[0] self.assertIsInstance(record, accessor_audit.GrantAccess) self.assertEqual(record.signed_agreement, signed_agreement_1) self.assertEqual(record.user, account_1.user) self.assertEqual(record.member, account_1) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT) def test_queryset(self): """Audit only runs on the specified queryset of SignedAgreements.""" @@ -2794,9 +2794,7 @@ def test_queryset(self): signed_agreement_1.accessors.add(account_1.user) signed_agreement_2 = factories.SignedAgreementFactory.create() # First application - audit = accessor_audit.SignedAgreementAccessorAudit( - queryset=models.SignedAgreement.objects.filter(pk=signed_agreement_1.pk) - ) + audit = accessor_audit.AccessorAudit(queryset=models.SignedAgreement.objects.filter(pk=signed_agreement_1.pk)) audit.run_audit() self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 1) @@ -2806,11 +2804,9 @@ def test_queryset(self): self.assertEqual(record.signed_agreement, signed_agreement_1) self.assertEqual(record.user, account_1.user) self.assertEqual(record.member, account_1) - self.assertEqual(record.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT) + self.assertEqual(record.note, accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT) # Second application - audit = accessor_audit.SignedAgreementAccessorAudit( - queryset=models.SignedAgreement.objects.filter(pk=signed_agreement_2.pk) - ) + audit = accessor_audit.AccessorAudit(queryset=models.SignedAgreement.objects.filter(pk=signed_agreement_2.pk)) audit.run_audit() self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -2819,9 +2815,9 @@ def test_queryset(self): def test_queryset_wrong_class(self): """Raises ValueError if queryset is not a QuerySet.""" with self.assertRaises(ValueError): - accessor_audit.SignedAgreementAccessorAudit(queryset="foo") + accessor_audit.AccessorAudit(queryset="foo") with self.assertRaises(ValueError): - accessor_audit.SignedAgreementAccessorAudit(queryset=models.MemberAgreement.objects.all()) + accessor_audit.AccessorAudit(queryset=models.MemberAgreement.objects.all()) class DataAffiliateAgreementUploaderAuditTest(TestCase): @@ -2829,14 +2825,14 @@ class DataAffiliateAgreementUploaderAuditTest(TestCase): def test_completed(self): """completed is updated properly.""" - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() self.assertFalse(audit.completed) audit.run_audit() self.assertTrue(audit.completed) def test_no_applications(self): """Audit works if there are no DataAffiliateAgreements.""" - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.run_audit() self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -2846,7 +2842,7 @@ def test_audit_agreement_and_object_user(self): """audit_agreement_and_object works when passed a user object.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() user = UserFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, user) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2856,13 +2852,13 @@ def test_audit_agreement_and_object_user(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.NOT_UPLOADER) def test_audit_agreement_and_object_account(self): """audit_agreement_and_object works when passed an Account object.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() account = AccountFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, account) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2872,13 +2868,13 @@ def test_audit_agreement_and_object_account(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_group(self): """audit_agreement_and_object works when passed a ManagedGroup object.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() group = ManagedGroupFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, group) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2888,13 +2884,13 @@ def test_audit_agreement_and_object_group(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, uploader_audit.UploaderAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_user_email(self): """audit_agreement_and_object works when passed a string email for a user.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() user = UserFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, user.username) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2904,13 +2900,13 @@ def test_audit_agreement_and_object_user_email(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.NOT_UPLOADER) def test_audit_agreement_and_object_user_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for a user.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() user = UserFactory.create(username="foo@BAR.com") - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2920,13 +2916,13 @@ def test_audit_agreement_and_object_user_email_case_insensitive(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.NOT_UPLOADER) def test_audit_agreement_and_object_account_email(self): """audit_agreement_and_object works when passed a string email for an account.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() account = AccountFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, account.email) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2936,13 +2932,13 @@ def test_audit_agreement_and_object_account_email(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_account_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for an account.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() account = AccountFactory.create(email="foo@BAR.com") - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2952,13 +2948,13 @@ def test_audit_agreement_and_object_account_email_case_insensitive(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_audit_agreement_and_object_group_email(self): """audit_agreement_and_object works when passed a string email for a ManagedGroup.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() group = ManagedGroupFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, group.email) self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2968,13 +2964,13 @@ def test_audit_agreement_and_object_group_email(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, uploader_audit.UploaderAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_group_email_case_insensitive(self): """audit_agreement_and_object works when passed a string email for a ManagedGroup.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() group = ManagedGroupFactory.create(email="foo@BAR.com") - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, "FOO@bar.com") self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 0) @@ -2984,12 +2980,12 @@ def test_audit_agreement_and_object_group_email_case_insensitive(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.GROUP_WITHOUT_ACCESS) + self.assertEqual(record.note, uploader_audit.UploaderAudit.GROUP_WITHOUT_ACCESS) def test_audit_agreement_and_object_email_does_not_exist(self): """audit_agreement_and_object works when passed a ManagedGroup object.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() with self.assertRaises(ValueError) as e: audit.audit_agreement_and_object(data_affiliate_agreement, "foo@bar.com") self.assertIn( @@ -3000,7 +2996,7 @@ def test_audit_agreement_and_object_email_does_not_exist(self): def test_audit_agreement_and_object_other_object(self): """audit_agreement_and_object raises ValueError when passed an incorrect object.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() with self.assertRaises(ValueError): audit.audit_agreement_and_object(data_affiliate_agreement, object) @@ -3014,7 +3010,7 @@ def test_uploader_linked_account_in_access_group(self): # Access group membership. GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 1) @@ -3025,7 +3021,7 @@ def test_uploader_linked_account_in_access_group(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_IN_ACCESS_GROUP) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_IN_ACCESS_GROUP) def test_uploader_linked_account_not_in_access_group(self): # Create applications. @@ -3037,7 +3033,7 @@ def test_uploader_linked_account_not_in_access_group(self): # Access group membership. # GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) @@ -3048,7 +3044,7 @@ def test_uploader_linked_account_not_in_access_group(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT) def test_uploader_no_account(self): # Create applications. @@ -3061,7 +3057,7 @@ def test_uploader_no_account(self): # Access group membership. # GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 1) @@ -3072,7 +3068,7 @@ def test_uploader_no_account(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, user) self.assertEqual(record.member, None) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_NO_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_NO_ACCOUNT) def test_user_in_group_not_uploader(self): # Create applications. @@ -3084,7 +3080,7 @@ def test_user_in_group_not_uploader(self): # Access group membership. GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) @@ -3095,7 +3091,7 @@ def test_user_in_group_not_uploader(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, account.user) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.NOT_UPLOADER) def test_not_uploader_and_account_has_no_user(self): # Create applications. @@ -3107,7 +3103,7 @@ def test_not_uploader_and_account_has_no_user(self): # Access group membership. GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) @@ -3118,7 +3114,7 @@ def test_not_uploader_and_account_has_no_user(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, account) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) + self.assertEqual(record.note, uploader_audit.UploaderAudit.ACCOUNT_NOT_LINKED_TO_USER) def test_two_uploaders(self): """Audit works when there are two uploaders.""" @@ -3132,7 +3128,7 @@ def test_two_uploaders(self): # Access group membership. GroupAccountMembershipFactory.create(group=data_affiliate_agreement.anvil_upload_group, account=account_1) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 1) # One of the uploaders. @@ -3149,7 +3145,7 @@ def test_two_uploaders(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, account_2.user) self.assertEqual(record.member, account_2) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT) def test_unexpected_group_in_access_group(self): """A group unexpectedly has access.""" @@ -3162,7 +3158,7 @@ def test_unexpected_group_in_access_group(self): child_group=group, ) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) @@ -3173,13 +3169,13 @@ def test_unexpected_group_in_access_group(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, None) self.assertEqual(record.member, group) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UNEXPECTED_GROUP_ACCESS) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UNEXPECTED_GROUP_ACCESS) def test_representative_not_uploader(self): """Representative is not an uploader.""" # Create applications. data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) @@ -3191,7 +3187,7 @@ def test_representative_is_uploader(self): # Create applications. data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() data_affiliate_agreement.uploaders.add(data_affiliate_agreement.signed_agreement.representative) - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 1) @@ -3202,7 +3198,7 @@ def test_representative_is_uploader(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(record.user, data_affiliate_agreement.signed_agreement.representative) self.assertIsNone(record.member) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_NO_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_NO_ACCOUNT) def test_ignores_admins_group(self): """Ignores the admin group.""" @@ -3215,14 +3211,14 @@ def test_ignores_admins_group(self): child_group=group, ) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) self.assertEqual(len(audit.errors), 0) # Check the sub-method specifically. - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, group) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -3240,14 +3236,14 @@ def test_ignores_admins_group_different_setting(self): child_group=group, ) # Set up audit - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() # Run audit audit.audit_agreement(data_affiliate_agreement) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) self.assertEqual(len(audit.errors), 0) # Check the sub-method specifically. - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.audit_agreement_and_object(data_affiliate_agreement, group) self.assertEqual(len(audit.verified), 0) self.assertEqual(len(audit.needs_action), 0) @@ -3261,7 +3257,7 @@ def test_two_agreements(self): data_affiliate_agreement_2 = factories.DataAffiliateAgreementFactory.create() user_2 = UserFactory.create() data_affiliate_agreement_2.uploaders.add(user_2) - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.run_audit() self.assertEqual(len(audit.verified), 1) self.assertEqual(len(audit.needs_action), 1) @@ -3271,13 +3267,13 @@ def test_two_agreements(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement_2) self.assertEqual(record.user, user_2) self.assertEqual(record.member, None) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_NO_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_NO_ACCOUNT) record = audit.needs_action[0] self.assertIsInstance(record, uploader_audit.GrantAccess) self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement_1) self.assertEqual(record.user, account_1.user) self.assertEqual(record.member, account_1) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT) def test_queryset(self): """Audit only runs on the specified queryset of DataAffiliateAgreements.""" @@ -3286,7 +3282,7 @@ def test_queryset(self): data_affiliate_agreement_1.uploaders.add(account_1.user) data_affiliate_agreement_2 = factories.DataAffiliateAgreementFactory.create() # First application - audit = uploader_audit.DataAffiliateUploaderAudit( + audit = uploader_audit.UploaderAudit( queryset=models.DataAffiliateAgreement.objects.filter(pk=data_affiliate_agreement_1.pk) ) audit.run_audit() @@ -3298,9 +3294,9 @@ def test_queryset(self): self.assertEqual(record.data_affiliate_agreement, data_affiliate_agreement_1) self.assertEqual(record.user, account_1.user) self.assertEqual(record.member, account_1) - self.assertEqual(record.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT) + self.assertEqual(record.note, uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT) # Second application - audit = uploader_audit.DataAffiliateUploaderAudit( + audit = uploader_audit.UploaderAudit( queryset=models.DataAffiliateAgreement.objects.filter(pk=data_affiliate_agreement_2.pk) ) audit.run_audit() @@ -3311,16 +3307,16 @@ def test_queryset(self): def test_queryset_wrong_class(self): """Raises ValueError if queryset is not a QuerySet.""" with self.assertRaises(ValueError): - uploader_audit.DataAffiliateUploaderAudit(queryset="foo") + uploader_audit.UploaderAudit(queryset="foo") with self.assertRaises(ValueError): - uploader_audit.DataAffiliateUploaderAudit(queryset=models.SignedAgreement.objects.all()) + uploader_audit.UploaderAudit(queryset=models.SignedAgreement.objects.all()) def test_queryset_only_data_affiliates(self): """Only DataAffiliateAgreements are included in the audit.""" data_affiliate_agreement = factories.DataAffiliateAgreementFactory.create() member_agreement = factories.MemberAgreementFactory.create() non_data_affiliate_agreement = factories.NonDataAffiliateAgreementFactory.create() - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() self.assertEqual(audit.queryset.count(), 1) self.assertIn(data_affiliate_agreement, audit.queryset) self.assertNotIn(member_agreement, audit.queryset) diff --git a/primed/cdsa/tests/test_views.py b/primed/cdsa/tests/test_views.py index 8189af9a..52cbecf5 100644 --- a/primed/cdsa/tests/test_views.py +++ b/primed/cdsa/tests/test_views.py @@ -6882,8 +6882,8 @@ def test_anvil_cdsa_group_does_not_exist(self): self.assertEqual(membership.role, membership.MEMBER) -class SignedAgreementAccessorAuditTest(TestCase): - """Tests for the SignedAgreementAccessorAudit view.""" +class AccessorAuditTest(TestCase): + """Tests for the AccessorAudit view.""" def setUp(self): """Set up test class.""" @@ -6903,7 +6903,7 @@ def get_url(self, *args): def get_view(self): """Return the view being tested.""" - return views.SignedAgreementAccessorAudit.as_view() + return views.AccessorAudit.as_view() def test_view_redirect_not_logged_in(self): "View redirects to login view when user is not logged in." @@ -6945,7 +6945,7 @@ def test_context_data_access_audit(self): audit = response.context_data["audit"] self.assertIsInstance( audit, - accessor_audit.SignedAgreementAccessorAudit, + accessor_audit.AccessorAudit, ) self.assertTrue(audit.completed) @@ -7015,7 +7015,7 @@ def test_context_verified_table_access(self): table = response.context_data["verified_table"] self.assertIsInstance( table, - accessor_audit.SignedAgreementAccessorAuditTable, + accessor_audit.AccessorAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("signed_agreement"), member_agreement.signed_agreement) @@ -7023,7 +7023,7 @@ def test_context_verified_table_access(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_IN_ACCESS_GROUP, + accessor_audit.AccessorAudit.ACCESSOR_IN_ACCESS_GROUP, ) self.assertEqual(table.rows[0].get_cell_value("action"), "—") @@ -7040,7 +7040,7 @@ def test_context_verified_table_no_access(self): table = response.context_data["verified_table"] self.assertIsInstance( table, - accessor_audit.SignedAgreementAccessorAuditTable, + accessor_audit.AccessorAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("signed_agreement"), member_agreement.signed_agreement) @@ -7048,7 +7048,7 @@ def test_context_verified_table_no_access(self): self.assertEqual(table.rows[0].get_cell_value("user"), accessor) self.assertEqual( table.rows[0].get_cell_value("note"), - accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_NO_ACCOUNT, + accessor_audit.AccessorAudit.ACCESSOR_NO_ACCOUNT, ) self.assertEqual(table.rows[0].get_cell_value("action"), "—") @@ -7064,7 +7064,7 @@ def test_context_needs_action_table_grant(self): table = response.context_data["needs_action_table"] self.assertIsInstance( table, - accessor_audit.SignedAgreementAccessorAuditTable, + accessor_audit.AccessorAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("signed_agreement"), member_agreement.signed_agreement) @@ -7072,7 +7072,7 @@ def test_context_needs_action_table_grant(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT, + accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Grant access") self.assertIn( @@ -7099,7 +7099,7 @@ def test_context_needs_action_table_remove(self): table = response.context_data["needs_action_table"] self.assertIsInstance( table, - accessor_audit.SignedAgreementAccessorAuditTable, + accessor_audit.AccessorAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("signed_agreement"), member_agreement.signed_agreement) @@ -7107,7 +7107,7 @@ def test_context_needs_action_table_remove(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR, + accessor_audit.AccessorAudit.NOT_ACCESSOR, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Remove access") self.assertIn( @@ -7132,7 +7132,7 @@ def test_context_error_table_has_access(self): table = response.context_data["errors_table"] self.assertIsInstance( table, - accessor_audit.SignedAgreementAccessorAuditTable, + accessor_audit.AccessorAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("signed_agreement"), member_agreement.signed_agreement) @@ -7140,7 +7140,7 @@ def test_context_error_table_has_access(self): self.assertIsNone(table.rows[0].get_cell_value("user")) self.assertEqual( table.rows[0].get_cell_value("note"), - accessor_audit.SignedAgreementAccessorAudit.UNEXPECTED_GROUP_ACCESS, + accessor_audit.AccessorAudit.UNEXPECTED_GROUP_ACCESS, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Remove access") self.assertIn( @@ -7152,8 +7152,8 @@ def test_context_error_table_has_access(self): ) -class SignedAgreementAccessorAuditResolveTest(AnVILAPIMockTestMixin, TestCase): - """Tests for the SignedAgreementAccessorAuditResolve view.""" +class AccessorAuditResolveTest(AnVILAPIMockTestMixin, TestCase): + """Tests for the AccessorAuditResolve view.""" def setUp(self): """Set up test class.""" @@ -7177,7 +7177,7 @@ def get_url(self, *args): def get_view(self): """Return the view being tested.""" - return views.SignedAgreementAccessorAuditResolve.as_view() + return views.AccessorAuditResolve.as_view() def test_view_redirect_not_logged_in(self): "View redirects to login view when user is not logged in." @@ -7421,7 +7421,7 @@ def test_get_verified_access(self): self.assertEqual(audit_result.signed_agreement, member_agreement.signed_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_IN_ACCESS_GROUP) + self.assertEqual(audit_result.note, accessor_audit.AccessorAudit.ACCESSOR_IN_ACCESS_GROUP) self.assertIsNone(audit_result.action) def test_get_verified_no_access(self): @@ -7441,7 +7441,7 @@ def test_get_verified_no_access(self): self.assertEqual(audit_result.signed_agreement, member_agreement.signed_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(audit_result.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) self.assertIsNone(audit_result.action) def test_get_grant_access(self): @@ -7462,7 +7462,7 @@ def test_get_grant_access(self): self.assertEqual(audit_result.signed_agreement, member_agreement.signed_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, accessor_audit.SignedAgreementAccessorAudit.ACCESSOR_LINKED_ACCOUNT) + self.assertEqual(audit_result.note, accessor_audit.AccessorAudit.ACCESSOR_LINKED_ACCOUNT) self.assertIsNotNone(audit_result.action) def test_get_remove_access(self): @@ -7486,7 +7486,7 @@ def test_get_remove_access(self): self.assertEqual(audit_result.signed_agreement, member_agreement.signed_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, accessor_audit.SignedAgreementAccessorAudit.NOT_ACCESSOR) + self.assertEqual(audit_result.note, accessor_audit.AccessorAudit.NOT_ACCESSOR) self.assertIsNotNone(audit_result.action) def test_post_email_not_found(self): @@ -7691,7 +7691,7 @@ def test_post_grant_access_htmx(self): **header, ) # The membership was created. - self.assertEqual(response.content.decode(), views.SignedAgreementAccessorAuditResolve.htmx_success) + self.assertEqual(response.content.decode(), views.AccessorAuditResolve.htmx_success) membership = GroupAccountMembership.objects.get( group=member_agreement.signed_agreement.anvil_access_group, account=account, @@ -7852,7 +7852,7 @@ def test_anvil_api_error_grant_htmx(self): {}, **header, ) - self.assertEqual(response.content.decode(), views.SignedAgreementAccessorAuditResolve.htmx_error) + self.assertEqual(response.content.decode(), views.AccessorAuditResolve.htmx_error) # No membership was created. self.assertEqual(GroupAccountMembership.objects.count(), 0) # No messages were added. @@ -7925,7 +7925,7 @@ def test_anvil_api_error_remove_htmx(self): {}, **header, ) - self.assertEqual(response.content.decode(), views.SignedAgreementAccessorAuditResolve.htmx_error) + self.assertEqual(response.content.decode(), views.AccessorAuditResolve.htmx_error) # The group-group membership still exists. membership.refresh_from_db() # No messages was added. @@ -7933,8 +7933,8 @@ def test_anvil_api_error_remove_htmx(self): self.assertEqual(len(messages), 0) -class DataAffiliateUploaderAuditTest(TestCase): - """Tests for the DataAffiliateUploaderAudit view.""" +class UploaderAuditTest(TestCase): + """Tests for the UploaderAudit view.""" def setUp(self): """Set up test class.""" @@ -7954,7 +7954,7 @@ def get_url(self, *args): def get_view(self): """Return the view being tested.""" - return views.DataAffiliateUploaderAudit.as_view() + return views.UploaderAudit.as_view() def test_view_redirect_not_logged_in(self): "View redirects to login view when user is not logged in." @@ -7996,7 +7996,7 @@ def test_context_data_access_audit(self): audit = response.context_data["audit"] self.assertIsInstance( audit, - uploader_audit.DataAffiliateUploaderAudit, + uploader_audit.UploaderAudit, ) self.assertTrue(audit.completed) @@ -8052,7 +8052,7 @@ def test_context_verified_table_access(self): table = response.context_data["verified_table"] self.assertIsInstance( table, - uploader_audit.DataAffiliateUploaderAuditTable, + uploader_audit.UploaderAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("data_affiliate_agreement"), data_affiliate_agreement) @@ -8060,7 +8060,7 @@ def test_context_verified_table_access(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - uploader_audit.DataAffiliateUploaderAudit.UPLOADER_IN_ACCESS_GROUP, + uploader_audit.UploaderAudit.UPLOADER_IN_ACCESS_GROUP, ) self.assertEqual(table.rows[0].get_cell_value("action"), "—") @@ -8077,7 +8077,7 @@ def test_context_verified_table_no_access(self): table = response.context_data["verified_table"] self.assertIsInstance( table, - uploader_audit.DataAffiliateUploaderAuditTable, + uploader_audit.UploaderAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("data_affiliate_agreement"), data_affiliate_agreement) @@ -8085,7 +8085,7 @@ def test_context_verified_table_no_access(self): self.assertEqual(table.rows[0].get_cell_value("user"), uploader) self.assertEqual( table.rows[0].get_cell_value("note"), - uploader_audit.DataAffiliateUploaderAudit.UPLOADER_NO_ACCOUNT, + uploader_audit.UploaderAudit.UPLOADER_NO_ACCOUNT, ) self.assertEqual(table.rows[0].get_cell_value("action"), "—") @@ -8101,7 +8101,7 @@ def test_context_needs_action_table_grant(self): table = response.context_data["needs_action_table"] self.assertIsInstance( table, - uploader_audit.DataAffiliateUploaderAuditTable, + uploader_audit.UploaderAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("data_affiliate_agreement"), data_affiliate_agreement) @@ -8109,7 +8109,7 @@ def test_context_needs_action_table_grant(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT, + uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Grant access") self.assertIn( @@ -8136,7 +8136,7 @@ def test_context_needs_action_table_remove(self): table = response.context_data["needs_action_table"] self.assertIsInstance( table, - uploader_audit.DataAffiliateUploaderAuditTable, + uploader_audit.UploaderAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("data_affiliate_agreement"), data_affiliate_agreement) @@ -8144,7 +8144,7 @@ def test_context_needs_action_table_remove(self): self.assertEqual(table.rows[0].get_cell_value("user"), account.user) self.assertEqual( table.rows[0].get_cell_value("note"), - uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER, + uploader_audit.UploaderAudit.NOT_UPLOADER, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Remove access") self.assertIn( @@ -8169,7 +8169,7 @@ def test_context_error_table_has_access(self): table = response.context_data["errors_table"] self.assertIsInstance( table, - uploader_audit.DataAffiliateUploaderAuditTable, + uploader_audit.UploaderAuditTable, ) self.assertEqual(len(table.rows), 1) self.assertEqual(table.rows[0].get_cell_value("data_affiliate_agreement"), data_affiliate_agreement) @@ -8177,7 +8177,7 @@ def test_context_error_table_has_access(self): self.assertIsNone(table.rows[0].get_cell_value("user")) self.assertEqual( table.rows[0].get_cell_value("note"), - uploader_audit.DataAffiliateUploaderAudit.UNEXPECTED_GROUP_ACCESS, + uploader_audit.UploaderAudit.UNEXPECTED_GROUP_ACCESS, ) self.assertEqual(table.rows[0].get_cell_value("action"), "Remove access") self.assertIn( @@ -8199,8 +8199,8 @@ def test_audit_queryset_other_agreement_types(self): self.assertEqual(audit.queryset.count(), 0) -class DataAffiliateUploaderAuditResolveTest(AnVILAPIMockTestMixin, TestCase): - """Tests for the DataAffiliateUploaderAuditResolve view.""" +class UploaderAuditResolveTest(AnVILAPIMockTestMixin, TestCase): + """Tests for the UploaderAuditResolve view.""" def setUp(self): """Set up test class.""" @@ -8224,7 +8224,7 @@ def get_url(self, *args): def get_view(self): """Return the view being tested.""" - return views.DataAffiliateUploaderAuditResolve.as_view() + return views.UploaderAuditResolve.as_view() def test_view_redirect_not_logged_in(self): "View redirects to login view when user is not logged in." @@ -8466,7 +8466,7 @@ def test_get_verified_access(self): self.assertEqual(audit_result.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_IN_ACCESS_GROUP) + self.assertEqual(audit_result.note, uploader_audit.UploaderAudit.UPLOADER_IN_ACCESS_GROUP) self.assertIsNone(audit_result.action) def test_get_verified_no_access(self): @@ -8486,7 +8486,7 @@ def test_get_verified_no_access(self): self.assertEqual(audit_result.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(audit_result.note, uploader_audit.UploaderAudit.NOT_UPLOADER) self.assertIsNone(audit_result.action) def test_get_grant_access(self): @@ -8507,7 +8507,7 @@ def test_get_grant_access(self): self.assertEqual(audit_result.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, uploader_audit.DataAffiliateUploaderAudit.UPLOADER_LINKED_ACCOUNT) + self.assertEqual(audit_result.note, uploader_audit.UploaderAudit.UPLOADER_LINKED_ACCOUNT) self.assertIsNotNone(audit_result.action) def test_get_remove_access(self): @@ -8531,7 +8531,7 @@ def test_get_remove_access(self): self.assertEqual(audit_result.data_affiliate_agreement, data_affiliate_agreement) self.assertEqual(audit_result.member, account) self.assertEqual(audit_result.user, account.user) - self.assertEqual(audit_result.note, uploader_audit.DataAffiliateUploaderAudit.NOT_UPLOADER) + self.assertEqual(audit_result.note, uploader_audit.UploaderAudit.NOT_UPLOADER) self.assertIsNotNone(audit_result.action) def test_post_email_not_found(self): @@ -8736,7 +8736,7 @@ def test_post_grant_access_htmx(self): **header, ) # The membership was created. - self.assertEqual(response.content.decode(), views.DataAffiliateUploaderAuditResolve.htmx_success) + self.assertEqual(response.content.decode(), views.UploaderAuditResolve.htmx_success) membership = GroupAccountMembership.objects.get( group=data_affiliate_agreement.anvil_upload_group, account=account, @@ -8897,7 +8897,7 @@ def test_anvil_api_error_grant_htmx(self): {}, **header, ) - self.assertEqual(response.content.decode(), views.DataAffiliateUploaderAuditResolve.htmx_error) + self.assertEqual(response.content.decode(), views.UploaderAuditResolve.htmx_error) # No membership was created. self.assertEqual(GroupAccountMembership.objects.count(), 0) # No messages were added. @@ -8970,7 +8970,7 @@ def test_anvil_api_error_remove_htmx(self): {}, **header, ) - self.assertEqual(response.content.decode(), views.DataAffiliateUploaderAuditResolve.htmx_error) + self.assertEqual(response.content.decode(), views.UploaderAuditResolve.htmx_error) # The group-group membership still exists. membership.refresh_from_db() # No messages was added. diff --git a/primed/cdsa/urls.py b/primed/cdsa/urls.py index 320eb929..53c01d78 100644 --- a/primed/cdsa/urls.py +++ b/primed/cdsa/urls.py @@ -148,10 +148,10 @@ signed_agreement_accessor_audit_patterns = ( [ - path("", views.SignedAgreementAccessorAudit.as_view(), name="all"), + path("", views.AccessorAudit.as_view(), name="all"), path( "resolve///", - views.SignedAgreementAccessorAuditResolve.as_view(), + views.AccessorAuditResolve.as_view(), name="resolve", ), ], @@ -160,10 +160,10 @@ signed_agreement_uploader_audit_patterns = ( [ - path("", views.DataAffiliateUploaderAudit.as_view(), name="all"), + path("", views.UploaderAudit.as_view(), name="all"), path( "resolve///", - views.DataAffiliateUploaderAuditResolve.as_view(), + views.UploaderAuditResolve.as_view(), name="resolve", ), ], diff --git a/primed/cdsa/views.py b/primed/cdsa/views.py index 3ac664ce..d534b96f 100644 --- a/primed/cdsa/views.py +++ b/primed/cdsa/views.py @@ -773,14 +773,14 @@ def form_valid(self, form): return super().form_valid(form) -class SignedAgreementAccessorAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView): +class AccessorAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView): """View to show accessor audit results for `SignedAgreements`.""" template_name = "cdsa/signedagreement_accessor_audit.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - audit = accessor_audit.SignedAgreementAccessorAudit() + audit = accessor_audit.AccessorAudit() audit.run_audit() context["verified_table"] = audit.get_verified_table() context["errors_table"] = audit.get_errors_table() @@ -789,7 +789,7 @@ def get_context_data(self, **kwargs): return context -class SignedAgreementAccessorAuditResolve(AnVILConsortiumManagerStaffEditRequired, FormView): +class AccessorAuditResolve(AnVILConsortiumManagerStaffEditRequired, FormView): form_class = Form template_name = "cdsa/signedagreement_accessor_audit_resolve.html" htmx_success = """ Handled!""" @@ -807,7 +807,7 @@ def get_email(self): return self.kwargs.get("email") def get_audit_result(self): - audit = accessor_audit.SignedAgreementAccessorAudit( + audit = accessor_audit.AccessorAudit( queryset=models.SignedAgreement.objects.filter(pk=self.signed_agreement.pk) ) # No way to include a queryset of members at this point - need to call the sub method directly. @@ -886,14 +886,14 @@ def form_valid(self, form): return super().form_valid(form) -class DataAffiliateUploaderAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView): +class UploaderAudit(AnVILConsortiumManagerStaffViewRequired, TemplateView): """View to show uploader audit results for `DataAffiliateAgreements`.""" template_name = "cdsa/uploader_audit.html" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - audit = uploader_audit.DataAffiliateUploaderAudit() + audit = uploader_audit.UploaderAudit() audit.run_audit() context["verified_table"] = audit.get_verified_table() context["errors_table"] = audit.get_errors_table() @@ -902,7 +902,7 @@ def get_context_data(self, **kwargs): return context -class DataAffiliateUploaderAuditResolve(AnVILConsortiumManagerStaffEditRequired, FormView): +class UploaderAuditResolve(AnVILConsortiumManagerStaffEditRequired, FormView): form_class = Form template_name = "cdsa/uploader_audit_resolve.html" htmx_success = """ Handled!""" @@ -920,7 +920,7 @@ def get_email(self): return self.kwargs.get("email") def get_audit_result(self): - audit = uploader_audit.DataAffiliateUploaderAudit( + audit = uploader_audit.UploaderAudit( queryset=models.DataAffiliateAgreement.objects.filter(pk=self.data_affiliate_agreement.pk) ) # No way to include a queryset of members at this point - need to call the sub method directly.