blob: 78ab171e1cd88a9f363c3725ecb12794fdee3862 [file] [log] [blame]
Kuang-che Wue41e0062017-09-01 19:04:14 +08001# Copyright 2017 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4"""Test switch_git script."""
5
6from __future__ import print_function
7import unittest
8
9import mock
10
11import switch_git
12
13
14@mock.patch('bisect_kit.common.config_logging', mock.Mock())
15class TestSwitchGit(unittest.TestCase):
16 """Test switch_git.py."""
17
18 def test_main(self):
19 with mock.patch('bisect_kit.cli.argtype_dir_path', lambda x: x):
20 with mock.patch('bisect_kit.git_util.checkout_version') as mock_func:
21 git_repo = '/path/to/git/repo'
22 rev = '123456789'
23 switch_git.main(['--git_repo', git_repo, rev])
24
25 mock_func.assert_called_with(git_repo, rev)
26
27
28if __name__ == '__main__':
29 unittest.main()