mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
[git_auth] Move gitcookies to free backup name
Bug: 410576093 Change-Id: Ib2d9db97f4e4e1e8cfe1914ba7ffb881f9e16bbf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6453918 Reviewed-by: Yiwei Zhang <yiwzhang@google.com> Commit-Queue: Yiwei Zhang <yiwzhang@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
This commit is contained in:
@@ -362,6 +362,21 @@ class TestConfigWizard(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(got, want)
|
||||
|
||||
def test_move_file(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
path = os.path.join(d, 'foo')
|
||||
open(path, 'w').close()
|
||||
self.wizard._move_file(path)
|
||||
self.assertEqual(os.listdir(d), ['foo.bak'])
|
||||
|
||||
def test_move_file_backup_exists(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
path = os.path.join(d, 'foo')
|
||||
open(path, 'w').close()
|
||||
open(os.path.join(d, 'foo.bak'), 'w').close()
|
||||
self.wizard._move_file(path)
|
||||
self.assertEqual(sorted(os.listdir(d)), ['foo.bak', 'foo.bak2'])
|
||||
|
||||
|
||||
class _FakeUI(object):
|
||||
"""Implements UserInterface for testing."""
|
||||
|
||||
Reference in New Issue
Block a user