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>
diff --git a/cros_utils/bugs.py b/cros_utils/bugs.py
index 25da130..73248b6 100755
--- a/cros_utils/bugs.py
+++ b/cros_utils/bugs.py
@@ -143,7 +143,7 @@
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 53525b3..a029dc5 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 @@
},
)
- @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 @@
},
)
- @patch("bugs._WriteBugJSONFile")
+ @patch.object(bugs, "_WriteBugJSONFile")
def testBugCreationSeemsToWork(self, mock_write_json_file):
"""Tests CreateNewBug."""
test_case_additions = (
@@ -117,12 +118,12 @@
)
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 @@
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()