Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/api/v3/test/converters_test.py b/api/v3/test/converters_test.py
index 1bbd12c..088de89 100644
--- a/api/v3/test/converters_test.py
+++ b/api/v3/test/converters_test.py
@@ -1,6 +1,6 @@
-# Copyright 2020 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
+# Copyright 2020 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for converting internal protorpc to external protoc."""
from __future__ import print_function
@@ -32,7 +32,7 @@
from testing import testing_helpers
from tracker import field_helpers
from services import service_manager
-from proto import tracker_pb2
+from mrproto import tracker_pb2
from tracker import tracker_bizobj as tbo
EXPLICIT_DERIVATION = issue_objects_pb2.Derivation.Value('EXPLICIT')
@@ -896,23 +896,24 @@
def testIngestAttachmentUploads(self):
up_1 = issues_pb2.AttachmentUpload(
- filename='clown.gif', content='iTs prOUnOuNcED JIF')
- up_2 = issues_pb2.AttachmentUpload(
- filename='mowgli', content='cutest dog')
+ filename='clown.gif', content=b'iTs prOUnOuNcED JIF')
+ up_2 = issues_pb2.AttachmentUpload(filename='mowgli', content=b'cutest dog')
ingested = self.converter.IngestAttachmentUploads([up_1, up_2])
- expected = [framework_helpers.AttachmentUpload(
- 'clown.gif', 'iTs prOUnOuNcED JIF', 'image/gif'),
- framework_helpers.AttachmentUpload(
- 'mowgli', 'cutest dog', 'text/plain')]
+ expected = [
+ framework_helpers.AttachmentUpload(
+ 'clown.gif', b'iTs prOUnOuNcED JIF', 'image/gif'),
+ framework_helpers.AttachmentUpload(
+ 'mowgli', b'cutest dog', 'text/plain')
+ ]
self.assertEqual(ingested, expected)
def testtIngestAttachmentUploads_Invalid(self):
up_1 = issues_pb2.AttachmentUpload(filename='clown.gif')
- up_2 = issues_pb2.AttachmentUpload(content='cutest dog')
+ up_2 = issues_pb2.AttachmentUpload(content=b'cutest dog')
- with self.assertRaisesRegexp(
- exceptions.InputException, 'Uploaded .+\nUploaded .+'):
+ with self.assertRaisesRegex(exceptions.InputException,
+ 'Uploaded .+\nUploaded .+'):
self.converter.IngestAttachmentUploads([up_1, up_2])
def testIngestIssueDeltas(self):
@@ -1263,8 +1264,7 @@
err_msgs.append(
'Invalid `update_mask` for projects/proj-780/issues/3 delta.')
- with self.assertRaisesRegexp(exceptions.InputException,
- '\n'.join(err_msgs)):
+ with self.assertRaisesRegex(exceptions.InputException, '\n'.join(err_msgs)):
self.converter.IngestIssueDeltas(api_deltas)
def testIngestIssueDeltas_OutputOnlyIgnored(self):
@@ -1383,7 +1383,7 @@
r'eldDefs/2\): Could not parse NoDate',
]
error_messages_re = '\n'.join(error_messages)
- with self.assertRaisesRegexp(exceptions.InputException, error_messages_re):
+ with self.assertRaisesRegex(exceptions.InputException, error_messages_re):
self.converter.IngestIssueDeltas([api_delta])
@mock.patch('time.time', mock.MagicMock(return_value=CURRENT_TIME))
@@ -1450,7 +1450,7 @@
approval_value=issue_objects_pb2.ApprovalValue(name=av_name),
update_mask=field_mask_pb2.FieldMask(paths=['chicken']))
expected_err = 'Invalid `update_mask` for %s delta' % av_name
- with self.assertRaisesRegexp(exceptions.InputException, expected_err):
+ with self.assertRaisesRegex(exceptions.InputException, expected_err):
self.converter.IngestApprovalDeltas([approval_delta], self.user_1.user_id)
def testIngestApprovalDeltas_FilterFieldValues(self):
@@ -1483,8 +1483,8 @@
field_vals_remove=[approval_enum_fv, approval_2_fv],
approvers_remove=['users/222'],
)
- with self.assertRaisesRegexp(exceptions.InputException,
- 'Field .* does not belong to approval .*'):
+ with self.assertRaisesRegex(exceptions.InputException,
+ 'Field .* does not belong to approval .*'):
self.converter.IngestApprovalDeltas([approval_delta], self.user_1.user_id)
def testIngestApprovalDeltas_InvalidFieldValues(self):
@@ -1511,7 +1511,7 @@
approval_value=av,
approvers_remove=['users/222'],
)
- with self.assertRaisesRegexp(
+ with self.assertRaisesRegex(
exceptions.InputException,
'Field projects/proj/fieldDefs/404 is not in this project'):
self.converter.IngestApprovalDeltas([approval_delta], self.user_1.user_id)
@@ -1739,7 +1739,7 @@
name=project1_av_name, field_values=[project1_fv, project2_fv]),
update_mask=field_mask_pb2.FieldMask(paths=['field_values']))
- with self.assertRaisesRegexp(
+ with self.assertRaisesRegex(
exceptions.InputException,
'Field projects/proj/fieldDefs/%d is not in this project' %
self.field_def_6):
@@ -2028,7 +2028,7 @@
r'.+issue:.+[\n\r]+: Issue.+404.+not found'
]
error_messages_re = '\n'.join(error_messages)
- with self.assertRaisesRegexp(exceptions.InputException, error_messages_re):
+ with self.assertRaisesRegex(exceptions.InputException, error_messages_re):
self.converter.IngestIssue(ingest, self.project_1.project_id)
def testIngestIssuesListColumns(self):