Mike Frysinger | e58c0e2 | 2017-10-04 15:43:30 -0400 | [diff] [blame^] | 1 | # -*- coding: utf-8 -*- |
Ryan Cui | 47f80e4 | 2013-04-01 19:01:54 -0700 | [diff] [blame] | 2 | # Copyright (c) 2013 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 | |
Don Garrett | 25f309a | 2014-03-19 14:02:12 -0700 | [diff] [blame] | 6 | """Unittests for cros.""" |
| 7 | |
Mike Frysinger | 383367e | 2014-09-16 15:06:17 -0400 | [diff] [blame] | 8 | from __future__ import print_function |
| 9 | |
Ralph Nathan | 1fc77f2 | 2015-04-21 15:05:48 -0700 | [diff] [blame] | 10 | from chromite.lib import commandline |
Ryan Cui | 47f80e4 | 2013-04-01 19:01:54 -0700 | [diff] [blame] | 11 | from chromite.lib import cros_test_lib |
Ryan Cui | 47f80e4 | 2013-04-01 19:01:54 -0700 | [diff] [blame] | 12 | from chromite.scripts import cros |
| 13 | |
| 14 | |
Don Garrett | 4c2b917 | 2015-10-09 13:27:44 -0700 | [diff] [blame] | 15 | class RunScriptTest(cros_test_lib.MockTempDirTestCase): |
Ryan Cui | 47f80e4 | 2013-04-01 19:01:54 -0700 | [diff] [blame] | 16 | """Test the main functionality.""" |
| 17 | |
| 18 | def setUp(self): |
Ryan Cui | 47f80e4 | 2013-04-01 19:01:54 -0700 | [diff] [blame] | 19 | self.PatchObject(cros, '_RunSubCommand', autospec=True) |
| 20 | |
David Pursell | c7ba784 | 2015-07-08 10:48:41 -0700 | [diff] [blame] | 21 | def testDefaultLogLevel(self): |
| 22 | """Test that the default log level is set to notice.""" |
Ralph Nathan | 1fc77f2 | 2015-04-21 15:05:48 -0700 | [diff] [blame] | 23 | arg_parser = self.PatchObject(commandline, 'ArgumentParser', |
| 24 | return_value=commandline.ArgumentParser()) |
| 25 | cros.GetOptions({}) |
Ralph Nathan | 38372f4 | 2015-05-19 15:56:25 -0700 | [diff] [blame] | 26 | arg_parser.assert_called_with(caching=True, default_log_level='notice') |