blob: 8edd51280229b18684b65dd4f8e3a968ae1337e2 [file] [log] [blame]
Kuang-che Wu6e4beca2018-06-27 17:45:02 +08001# -*- coding: utf-8 -*-
Kuang-che Wue41e0062017-09-01 19:04:14 +08002# 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
7from __future__ import print_function
8import unittest
9
10import mock
11
12import switch_git
13
14
15@mock.patch('bisect_kit.common.config_logging', mock.Mock())
16class 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
29if __name__ == '__main__':
30 unittest.main()