From 5364c7205fe08d82733f98e5a9356daea60bd228 Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Wed, 25 Oct 2023 14:10:55 -0700 Subject: [PATCH 1/2] Print the correct number of "ok" instances in audit email Previously, this was printing 0 due to a bug. Now it prints the correct number. Add a test to check for this behavior. --- anvil_consortium_manager/management/commands/run_anvil_audit.py | 2 +- anvil_consortium_manager/tests/test_commands.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/anvil_consortium_manager/management/commands/run_anvil_audit.py b/anvil_consortium_manager/management/commands/run_anvil_audit.py index 66ace012..3b9347a2 100644 --- a/anvil_consortium_manager/management/commands/run_anvil_audit.py +++ b/anvil_consortium_manager/management/commands/run_anvil_audit.py @@ -80,7 +80,7 @@ def _run_audit(self, audit_results, **options): "anvil_consortium_manager/email_audit_report.html", context={ "model_name": audit_name, - "verified_results": len(audit_results.get_verified_results()), + "verified_results": audit_results.get_verified_results(), "errors_table": ErrorTableWithLink( audit_results.get_error_results() ), diff --git a/anvil_consortium_manager/tests/test_commands.py b/anvil_consortium_manager/tests/test_commands.py index 6380dcd2..6b623711 100644 --- a/anvil_consortium_manager/tests/test_commands.py +++ b/anvil_consortium_manager/tests/test_commands.py @@ -149,6 +149,8 @@ def test_command_run_audit_ok_email(self): self.assertEqual(pprint.pformat(audit_results.export()), email.body) # HTML body. self.assertEqual(len(email.alternatives), 1) + # Check that the number of "ok" instances is correct in email body. + self.assertIn("1 instance(s) verified", email.alternatives[0][0]) def test_command_run_audit_ok_email_errors_only(self): """Test command output when email and errors_only is set.""" From eddd9758108135ba422864c89967c80a62fb22be Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Wed, 25 Oct 2023 14:13:33 -0700 Subject: [PATCH 2/2] Bump version number and update CHANGELOG --- CHANGELOG.md | 1 + anvil_consortium_manager/__init__.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b03d490..15cb75d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Devel * Add filtering in list views. +* Bugfix: Print the correct number of "ok" instances in audit emails. 0.18 introduced a bug where the email included "0 instance(s) verified even if there was more than one verified instance. ## 0.18 (2023-10-03) diff --git a/anvil_consortium_manager/__init__.py b/anvil_consortium_manager/__init__.py index c59266c2..b8873deb 100644 --- a/anvil_consortium_manager/__init__.py +++ b/anvil_consortium_manager/__init__.py @@ -1 +1 @@ -__version__ = "0.19dev1" +__version__ = "0.19dev2"