From b6f459b87ca0a3e6e42c6b85cec3a42b09c370b4 Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Mon, 25 Mar 2024 23:23:39 +0000 Subject: [PATCH] [gerrit_client] Fix test to not hit real gerrit service. There may be other tests which aren't correct though, this is just the one I saw during presubmit. R=aravindvasudev@google.com Bug: 330347045 Change-Id: I6499b5103bf15c30f5e8a2fdcd7abeba094a39d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5394357 Auto-Submit: Robbie Iannucci Reviewed-by: Aravind Vasudevan Commit-Queue: Aravind Vasudevan --- tests/gerrit_client_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/gerrit_client_test.py b/tests/gerrit_client_test.py index 3a0839f23..7b3b111d1 100755 --- a/tests/gerrit_client_test.py +++ b/tests/gerrit_client_test.py @@ -27,13 +27,16 @@ class TestGerritClient(unittest.TestCase): 'branchname') @mock.patch('gerrit_util.CreateGerritBranch', return_value='') - def test_branch(self, util_mock): + @mock.patch('gerrit_util.GetGerritBranch', return_value='') + def test_branch(self, _, CreateGerritBranch_mock): gerrit_client.main([ 'branch', '--host', 'https://example.org/foo', '--project', 'projectname', '--branch', 'branchname', '--commit', 'commitname' ]) - util_mock.assert_called_once_with('example.org', 'projectname', - 'branchname', 'commitname') + CreateGerritBranch_mock.assert_called_once_with('example.org', + 'projectname', + 'branchname', + 'commitname') @mock.patch('gerrit_util.QueryChanges', return_value='') def test_changes(self, util_mock):