-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
656729c
commit 9dc9192
Showing
6 changed files
with
40 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,17 +113,13 @@ def test_command_output_no_records(self): | |
"""Test command output.""" | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running SignedAgreement access audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running CDSAWorkspace access audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = "Running Accessor audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Uploader audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Accessor audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
expected_output = "Running Uploader audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -134,9 +130,7 @@ def test_command_agreements_one_agreement_verified(self): | |
factories.DataAffiliateAgreementFactory.create(is_primary=False) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... ok!\n" "* Verified: 1\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running SignedAgreement access audit... ok!\n* Verified: 1\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
@@ -147,10 +141,7 @@ def test_command_agreements_one_agreement_needs_action(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:sag:all"), out.getvalue()) | ||
|
@@ -167,10 +158,7 @@ def test_command_agreements_one_agreement_error(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 0\n" | ||
"* Errors: 1\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:sag:all"), out.getvalue()) | ||
|
@@ -192,10 +180,7 @@ def test_command_agreements_one_agreement_needs_action_email(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
# One message has been sent by default. | ||
|
@@ -215,10 +200,7 @@ def test_command_agreements_one_agreement_error_email(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 0\n" | ||
"* Errors: 1\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:sag:all"), out.getvalue()) | ||
|
@@ -234,9 +216,7 @@ def test_command_workspaces_one_workspace_verified(self): | |
factories.CDSAWorkspaceFactory.create() | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... ok!\n" "* Verified: 1\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running CDSAWorkspace access audit... ok!\n* Verified: 1\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
@@ -252,10 +232,7 @@ def test_command_workspaces_one_workspace_needs_action(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:workspaces:all"), out.getvalue()) | ||
|
@@ -272,10 +249,7 @@ def test_command_workspaces_one_workspace_error(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 0\n" | ||
"* Errors: 1\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:workspaces:all"), out.getvalue()) | ||
|
@@ -302,10 +276,7 @@ def test_command_workspaces_one_workspace_needs_action_email(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
# One message has been sent by default. | ||
|
@@ -325,10 +296,7 @@ def test_command_workspaces_one_workspace_error_email(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 0\n" | ||
"* Errors: 1\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:workspaces:all"), out.getvalue()) | ||
|
@@ -344,7 +312,7 @@ def test_accessors_no_accessors(self): | |
factories.DataAffiliateAgreementFactory.create(is_primary=False) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = "Running Accessor audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Accessor audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -356,7 +324,7 @@ def test_command_accessors_verified(self): | |
agreement.signed_agreement.accessors.add(UserFactory.create()) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = "Running Accessor audit... ok!\n" "* Verified: 1\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Accessor audit... ok!\n* Verified: 1\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
@@ -368,9 +336,7 @@ def test_command_accessors_needs_action(self): | |
agreement.signed_agreement.accessors.add(account.user) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:accessors:all"), out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -384,9 +350,7 @@ def test_command_accessors_error(self): | |
) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 1\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:accessors:all"), out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -412,9 +376,7 @@ def test_command_accessors_needs_action_email(self): | |
agreement.signed_agreement.accessors.add(account.user) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# One message has been sent by default. | ||
self.assertEqual(len(mail.outbox), 1) | ||
|
@@ -431,9 +393,7 @@ def test_command_accessors_error_email(self): | |
) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 1\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:accessors:all"), out.getvalue()) | ||
# One message has been sent by default. | ||
|
@@ -448,7 +408,7 @@ def test_uploaders_no_uploaders(self): | |
factories.DataAffiliateAgreementFactory.create(is_primary=False) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = "Running Uploader audit... ok!\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Uploader audit... ok!\n* Verified: 0\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -460,7 +420,7 @@ def test_command_uploaders_verified(self): | |
agreement.uploaders.add(UserFactory.create()) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = "Running Uploader audit... ok!\n" "* Verified: 1\n" "* Needs action: 0\n" "* Errors: 0\n" | ||
expected_output = "Running Uploader audit... ok!\n* Verified: 1\n* Needs action: 0\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Zero messages have been sent by default. | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
@@ -472,9 +432,7 @@ def test_command_uploaders_needs_action(self): | |
agreement.uploaders.add(account.user) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:uploaders:all"), out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -488,9 +446,7 @@ def test_command_uploaders_error(self): | |
) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 1\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:uploaders:all"), out.getvalue()) | ||
# Zero messages have been sent by default. | ||
|
@@ -516,9 +472,7 @@ def test_command_uploaders_needs_action_email(self): | |
agreement.uploaders.add(account.user) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# One message has been sent by default. | ||
self.assertEqual(len(mail.outbox), 1) | ||
|
@@ -535,9 +489,7 @@ def test_command_uploaders_error_email(self): | |
) | ||
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 0\n" "* Errors: 1\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 0\n* Errors: 1\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
self.assertIn(reverse("cdsa:audit:signed_agreements:uploaders:all"), out.getvalue()) | ||
# One message has been sent by default. | ||
|
@@ -555,26 +507,16 @@ def test_needs_action(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# No messages have been sent by default. | ||
self.assertEqual(len(mail.outbox), 0) | ||
|
@@ -587,26 +529,16 @@ def test_needs_action_email(self): | |
out = StringIO() | ||
call_command("run_cdsa_audit", "--no-color", email="[email protected]", stdout=out) | ||
expected_output = ( | ||
"Running CDSAWorkspace access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running CDSAWorkspace access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running SignedAgreement access audit... problems found.\n" | ||
"* Verified: 0\n" | ||
"* Needs action: 1\n" | ||
"* Errors: 0\n" | ||
"Running SignedAgreement access audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
) | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running Accessor audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Accessor audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
expected_output = ( | ||
"Running Uploader audit... problems found.\n" "* Verified: 0\n" "* Needs action: 1\n" "* Errors: 0\n" | ||
) | ||
expected_output = "Running Uploader audit... problems found.\n* Verified: 0\n* Needs action: 1\n* Errors: 0\n" | ||
self.assertIn(expected_output, out.getvalue()) | ||
# Two messages has been sent. | ||
self.assertEqual(len(mail.outbox), 4) | ||
|
Oops, something went wrong.