Merge branch 'main' into avm99963-monorail

Merged commit 4137ed7879acadbf891e8c471108acb874dae886.

GitOrigin-RevId: b6100ffc5b1da355a35f37b13fcaaf746ee8b307
diff --git a/businesslogic/test/work_env_test.py b/businesslogic/test/work_env_test.py
index 63ac60f..dd93bf7 100644
--- a/businesslogic/test/work_env_test.py
+++ b/businesslogic/test/work_env_test.py
@@ -1454,14 +1454,18 @@
         summary='sum',
         status='New',
         field_values=[input_fv])
+    attachments = [
+      ('README.md', 'readme content', 'text/plain'),
+      ('hello.txt', 'hello content', 'text/plain')]
     with self.work_env as we:
-      actual_issue = we.MakeIssue(input_issue, 'description', False)
+      actual_issue = we.MakeIssue(
+        input_issue, 'description', False, attachments)
     self.assertEqual(actual_issue.project_id, 789)
     self.assertEqual(actual_issue.summary, 'sum')
     self.assertEqual(actual_issue.status, 'New')
     self.assertEqual(actual_issue.reporter_id, 111)
     self.assertEqual(actual_issue.field_values, [input_fv])
-
+    self.assertEqual(2, actual_issue.attachment_count)
   @mock.patch(
       'features.send_notifications.PrepareAndSendIssueBlockingNotification')
   @mock.patch(
diff --git a/businesslogic/work_env.py b/businesslogic/work_env.py
index 0854209..d15d67f 100644
--- a/businesslogic/work_env.py
+++ b/businesslogic/work_env.py
@@ -1212,7 +1212,12 @@
 
     return tracker_pb2.Issue()
 
-  def MakeIssue(self, issue, description, send_email):
+  def MakeIssue(
+    self,
+    issue,
+    description,
+    send_email,
+    attachment_uploads=None):
     # type: (tracker_pb2.Issue, str, bool) -> tracker_pb2.Issue
     """Check restricted field permissions and create issue.
 
@@ -1220,7 +1225,8 @@
       issue: Data for the created issue in a Protocol Bugger.
       description: Description for the initial description comment created.
       send_email: Whether this issue creation should email people.
-
+      attachment_uploads: List of AttachmentUpload tuples to be attached to the
+        new issue.
     Returns:
       The created Issue PB.
 
@@ -1246,6 +1252,7 @@
         description,
         blocked_on=issue.blocked_on_iids,
         blocking=issue.blocking_iids,
+        attachments=attachment_uploads,
         dangling_blocked_on=issue.dangling_blocked_on_refs,
         dangling_blocking=issue.dangling_blocking_refs,
         send_email=send_email)