Use logger where unit test has coverage

Change-Id: I0a4d16fef3aed6bba0c6015fe861a2f11558e11b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2029114
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 3101aa3..6ad36d5 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -2094,9 +2094,17 @@
         ((['git', 'config', 'branch.master.merge'],), 'refs/heads/master'),
         ((['git', 'config', 'branch.master.remote'],), 'origin'),
         ((['git', 'config', 'remote.origin.url'],), 'custom-scheme://repo'),
+        (('logging.warning',
+            'Ignoring branch %(branch)s with non-https remote '
+            '%(remote)s', {
+              'branch': 'master',
+              'remote': 'custom-scheme://repo'}
+          ), None),
     ]
     self.mock(git_cl.gerrit_util, 'CookiesAuthenticator',
               CookiesAuthenticatorMockFactory(hosts_with_creds={}))
+    self.mock(logging, 'warning',
+              lambda *a: self._mocked_call('logging.warning', *a))
     cl = git_cl.Changelist()
     cl.branch = 'master'
     cl.branchref = 'refs/heads/master'
@@ -2111,9 +2119,18 @@
         ((['git', 'config', 'branch.master.remote'], ), 'origin'),
         ((['git', 'config', 'remote.origin.url'], ),
          'git@somehost.example:foo/bar.git'),
+        (('logging.error',
+            'Remote "%(remote)s" for branch "%(branch)s" points to "%(url)s", '
+            'but it doesn\'t exist.', {
+              'remote': 'origin',
+              'branch': 'master',
+              'url': 'git@somehost.example:foo/bar.git'}
+          ), None),
     ]
     self.mock(git_cl.gerrit_util, 'CookiesAuthenticator',
               CookiesAuthenticatorMockFactory(hosts_with_creds={}))
+    self.mock(logging, 'error',
+              lambda *a: self._mocked_call('logging.error', *a))
     cl = git_cl.Changelist()
     cl.branch = 'master'
     cl.branchref = 'refs/heads/master'
@@ -3031,7 +3048,7 @@
 
     self.mock(os.path, 'isdir', selective_os_path_isdir_mock)
     self.mock(logging, 'error',
-              lambda fmt, *a: self._mocked_call('logging.error', fmt % a))
+              lambda *a: self._mocked_call('logging.error', *a))
 
     self.calls = [
       ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
@@ -3042,8 +3059,12 @@
       (('os.path.isdir', '/cache/this-dir-doesnt-exist'),
        False),
       (('logging.error',
-        'Remote "origin" for branch "master" points to'
-        ' "/cache/this-dir-doesnt-exist", but it doesn\'t exist.'), None),
+          'Remote "%(remote)s" for branch "%(branch)s" points to "%(url)s", '
+          'but it doesn\'t exist.', {
+            'remote': 'origin',
+            'branch': 'master',
+            'url': '/cache/this-dir-doesnt-exist'}
+        ), None),
     ]
     cl = git_cl.Changelist(issue=1)
     self.assertIsNone(cl.GetRemoteUrl())
@@ -3094,11 +3115,21 @@
     self.assertEqual(cl._GerritChangeIdentifier(), 'my%2Frepo~123456')
 
   def test_gerrit_change_identifier_without_project(self):
+    self.mock(logging, 'error',
+              lambda *a: self._mocked_call('logging.error', *a))
+
     self.calls = [
       ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
       ((['git', 'config', 'branch.master.merge'],), 'master'),
       ((['git', 'config', 'branch.master.remote'],), 'origin'),
       ((['git', 'config', 'remote.origin.url'],), CERR1),
+      (('logging.error',
+          'Remote "%(remote)s" for branch "%(branch)s" points to "%(url)s", '
+          'but it doesn\'t exist.', {
+            'remote': 'origin',
+            'branch': 'master',
+            'url': ''}
+        ), None),
     ]
     cl = git_cl.Changelist(issue=123456)
     self.assertEqual(cl._GerritChangeIdentifier(), '123456')