This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/sbp by this push:
new 5bc8d2ef Fix an email bug and add tests
5bc8d2ef is described below
commit 5bc8d2efb8b2e4244c201d059fd5fe3c778fe128
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Mar 25 14:54:44 2026 +0000
Fix an email bug and add tests
---
atr/db/interaction.py | 2 +-
tests/unit/test_vote_recipients.py | 91 ++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/atr/db/interaction.py b/atr/db/interaction.py
index 006e1d8d..7f73f555 100644
--- a/atr/db/interaction.py
+++ b/atr/db/interaction.py
@@ -401,7 +401,7 @@ def task_recipient_get(latest_vote_task: sql.Task) -> str |
None:
return None
if not result.email_to:
return None
- return result.email_to[0]
+ return result.email_to
async def tasks_ongoing(
diff --git a/tests/unit/test_vote_recipients.py
b/tests/unit/test_vote_recipients.py
new file mode 100644
index 00000000..a9c434f8
--- /dev/null
+++ b/tests/unit/test_vote_recipients.py
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest.mock as mock
+from types import SimpleNamespace
+
+import pytest
+
+import atr.db.interaction as interaction
+import atr.models.results as results
+import atr.storage.writers.vote as vote
+
+
[email protected]
+async def test_send_resolution_reuses_original_vote_recipients() -> None:
+ data = mock.MagicMock()
+ data.flush = mock.AsyncMock()
+ data.commit = mock.AsyncMock()
+
+ writer = _writer_with_data(data)
+ latest_vote_task = _latest_vote_task()
+ release = SimpleNamespace(
+ project=SimpleNamespace(
+ key="project",
+ display_name="Project",
+ ),
+ version="1.0.0",
+ )
+
+ error = await writer.send_resolution(
+ release,
+ "passed",
+ "Resolution body",
+ "chair",
+ "Project Chair",
+ latest_vote_task,
+ )
+
+ assert error is None
+ data.add_all.assert_called_once()
+ queued_task = data.add_all.call_args.args[0][0]
+ assert queued_task.task_args["email_to"] == "[email protected]"
+ assert queued_task.task_args["email_cc"] == ["[email protected]"]
+ assert queued_task.task_args["email_bcc"] ==
["[email protected]"]
+
+
+def test_task_recipient_get_returns_full_vote_recipient() -> None:
+ latest_vote_task = _latest_vote_task()
+
+ recipient = interaction.task_recipient_get(latest_vote_task)
+
+ assert recipient == "[email protected]"
+
+
+def _latest_vote_task() -> SimpleNamespace:
+ return SimpleNamespace(
+ result=results.VoteInitiate(
+ kind="vote_initiate",
+ message="Vote announcement email sent successfully",
+ email_to="[email protected]",
+ vote_end="2026-03-31 12:00:00 UTC",
+ subject="[VOTE] Release project 1.0.0",
+ mid="[email protected]",
+ mail_send_warnings=[],
+ ),
+ task_args={
+ "email_to": "[email protected]",
+ "email_cc": ["[email protected]"],
+ "email_bcc": ["[email protected]"],
+ },
+ )
+
+
+def _writer_with_data(data: mock.MagicMock) -> vote.CommitteeMember:
+ writer = object.__new__(vote.CommitteeMember)
+ writer._CommitteeMember__data = data
+ return writer
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]