diff options
author | George Burgess IV <gbiv@google.com> | 2021-09-01 10:54:58 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-02 17:21:09 +0000 |
commit | 338c8897fcefd242419ed42719df274a112d5b5d (patch) | |
tree | d612e55c8bbd78ad8cb91cd6a3a40b9b63ab9b1e | |
parent | 7d81944cccf39425fb02325706c5b33b950790c4 (diff) | |
download | toolchain-utils-338c8897fcefd242419ed42719df274a112d5b5d.tar.gz |
email_sender: s/sheriff/detective
Now that our backend for this supports detective as an alternate
spelling of sheriff, we can migrate this.
This includes forced auto-style-fixing from yapf.
BUG=b:198446837
TEST=Unittests
Change-Id: Ib371911a006d40149dfbf91cc5daf834066a451c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3137202
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
-rwxr-xr-x | cros_utils/email_sender.py | 16 | ||||
-rwxr-xr-x | cros_utils/email_sender_unittest.py | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/cros_utils/email_sender.py b/cros_utils/email_sender.py index 6b8893ea..df8afbc4 100755 --- a/cros_utils/email_sender.py +++ b/cros_utils/email_sender.py @@ -71,7 +71,7 @@ class EmailSender(object): "From" email address. Must be nonempty. well_known_recipients: a list of well-known recipients for the email. These are translated into addresses by our mailer. - Current potential values for this are ('sheriff', + Current potential values for this are ('detective', 'cwp-team', 'cros-team', 'mage'). Either this or direct_recipients must be a nonempty list. direct_recipients: @google.com emails to send addresses to. Either this @@ -89,8 +89,8 @@ class EmailSender(object): type(well_known_recipients)) if not isinstance(direct_recipients, (tuple, list)): - raise ValueError( - '`direct_recipients` is unexpectedly a %s' % type(direct_recipients)) + raise ValueError('`direct_recipients` is unexpectedly a %s' % + type(direct_recipients)) if not subject or not identifier: raise ValueError('both `subject` and `identifier` must be nonempty') @@ -205,8 +205,8 @@ class EmailSender(object): to_be_deleted = [] try: - with tempfile.NamedTemporaryFile( - 'w', encoding='utf-8', delete=False) as f: + with tempfile.NamedTemporaryFile('w', encoding='utf-8', + delete=False) as f: f.write(text_to_send) f.flush() to_be_deleted.append(f.name) @@ -239,8 +239,10 @@ class EmailSender(object): report_suffix = '_report.html' else: report_suffix = '_report.txt' - with tempfile.NamedTemporaryFile( - 'w', encoding='utf-8', delete=False, suffix=report_suffix) as f: + with tempfile.NamedTemporaryFile('w', + encoding='utf-8', + delete=False, + suffix=report_suffix) as f: f.write(attachment.content) f.flush() attachment_files.append(f.name) diff --git a/cros_utils/email_sender_unittest.py b/cros_utils/email_sender_unittest.py index 73492196..ae41f143 100755 --- a/cros_utils/email_sender_unittest.py +++ b/cros_utils/email_sender_unittest.py @@ -69,7 +69,7 @@ class Test(unittest.TestCase): 'subject': 'foo', 'identifier': 'foo', # non-list recipients - 'well_known_recipients': 'sheriff', + 'well_known_recipients': 'detective', 'text_body': 'hi', }, ] @@ -89,8 +89,8 @@ class Test(unittest.TestCase): def actual_write_file(file_path): nonlocal written_obj - self.assertTrue( - file_path.startswith(email_sender.X20_PATH + '/'), file_path) + self.assertTrue(file_path.startswith(email_sender.X20_PATH + '/'), + file_path) f = io.StringIO() yield f written_obj = json.loads(f.getvalue()) @@ -99,7 +99,7 @@ class Test(unittest.TestCase): email_sender.EmailSender().SendX20Email( subject='hello', identifier='world', - well_known_recipients=['sheriff'], + well_known_recipients=['detective'], direct_recipients=['gbiv@google.com'], text_body='text', html_body='html', @@ -109,7 +109,7 @@ class Test(unittest.TestCase): written_obj, { 'subject': 'hello', 'email_identifier': 'world', - 'well_known_recipients': ['sheriff'], + 'well_known_recipients': ['detective'], 'direct_recipients': ['gbiv@google.com'], 'body': 'text', 'html_body': 'html', |