blob: 9ee12c40833d0ab233f4488059bbc88254500efd [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
Kuang-che Wu23192ad2020-03-11 18:12:46 +08009from unittest import mock
Kuang-che Wue41e0062017-09-01 19:04:14 +080010
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()