diff options
author | Denis Nikitin <denik@chromium.org> | 2023-02-23 11:23:40 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-23 22:22:16 +0000 |
commit | 61992c86d712f0a71f6494ff44744c580a8426ad (patch) | |
tree | 0aca05b31efc9e09303b8b9746813b7ea1883ea0 /cros_utils | |
parent | 8c0ec43fcc1494d0408e4fdec3a32653a60fddb1 (diff) | |
download | toolchain-utils-61992c86d712f0a71f6494ff44744c580a8426ad.tar.gz |
cros_utils: Rename ChrotomationCronjobUpdate
BUG=b:270576202
TEST=unittests
Change-Id: Ica1588fe32e65fbffdecec894f36b8a5669fd149
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4288228
Commit-Queue: Denis Nikitin <denik@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Denis Nikitin <denik@chromium.org>
Diffstat (limited to 'cros_utils')
-rwxr-xr-x | cros_utils/bugs.py | 2 | ||||
-rwxr-xr-x | cros_utils/bugs_test.py | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/cros_utils/bugs.py b/cros_utils/bugs.py index 25da130d..73248b60 100755 --- a/cros_utils/bugs.py +++ b/cros_utils/bugs.py @@ -143,7 +143,7 @@ def SendCronjobLog(cronjob_name: str, failed: bool, message: str): the cronjob infra deems it worthy. """ _WriteBugJSONFile( - "ChrotomationCronjobUpdate", + "CronjobUpdate", { "name": cronjob_name, "message": message, diff --git a/cros_utils/bugs_test.py b/cros_utils/bugs_test.py index 53525b30..a029dc52 100755 --- a/cros_utils/bugs_test.py +++ b/cros_utils/bugs_test.py @@ -10,11 +10,12 @@ import datetime import json +import os import tempfile import unittest from unittest.mock import patch -import bugs +from cros_utils import bugs _ARBITRARY_DATETIME = datetime.datetime(2020, 1, 1, 23, 0, 0, 0) @@ -61,7 +62,7 @@ class Tests(unittest.TestCase): }, ) - @patch("bugs._WriteBugJSONFile") + @patch.object(bugs, "_WriteBugJSONFile") def testAppendingToBugsSeemsToWork(self, mock_write_json_file): """Tests AppendToExistingBug.""" bugs.AppendToExistingBug(1234, "hello, world!") @@ -73,7 +74,7 @@ class Tests(unittest.TestCase): }, ) - @patch("bugs._WriteBugJSONFile") + @patch.object(bugs, "_WriteBugJSONFile") def testBugCreationSeemsToWork(self, mock_write_json_file): """Tests CreateNewBug.""" test_case_additions = ( @@ -117,12 +118,12 @@ class Tests(unittest.TestCase): ) mock_write_json_file.reset_mock() - @patch("bugs._WriteBugJSONFile") + @patch.object(bugs, "_WriteBugJSONFile") def testCronjobLogSendingSeemsToWork(self, mock_write_json_file): """Tests SendCronjobLog.""" bugs.SendCronjobLog("my_name", False, "hello, world!") mock_write_json_file.assert_called_once_with( - "ChrotomationCronjobUpdate", + "CronjobUpdate", { "name": "my_name", "message": "hello, world!", @@ -154,7 +155,7 @@ class Tests(unittest.TestCase): fourth = gen.generate_json_file_name(_ARBITRARY_DATETIME) self.assertLess(third, fourth) - @patch("os.getpid") + @patch.object(os, "getpid") def testForkingProducesADifferentReport(self, mock_getpid): """Tests that _FileNameGenerator gives us sorted file names.""" gen = bugs._FileNameGenerator() |