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