Mike Frysinger | e58c0e2 | 2017-10-04 15:43:30 -0400 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 2 | # Copyright 2015 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 | |
| 6 | """Unittests for cros_show_waterfall_layout.""" |
| 7 | |
| 8 | from __future__ import print_function |
| 9 | |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 10 | import os |
Mike Frysinger | 6a2b0f2 | 2020-02-20 13:34:07 -0500 | [diff] [blame^] | 11 | import sys |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 12 | |
Aviv Keshet | b7519e1 | 2016-10-04 00:50:00 -0700 | [diff] [blame] | 13 | from chromite.lib import constants |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 14 | from chromite.lib import cros_test_lib |
| 15 | from chromite.scripts import cros_show_waterfall_layout |
| 16 | |
Mike Frysinger | 6a2b0f2 | 2020-02-20 13:34:07 -0500 | [diff] [blame^] | 17 | |
| 18 | assert sys.version_info >= (3, 6), 'This module requires Python 3.6+' |
| 19 | |
| 20 | |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 21 | # pylint: disable=protected-access |
| 22 | |
| 23 | |
Don Garrett | d2a6711 | 2018-12-04 18:26:47 -0800 | [diff] [blame] | 24 | class DumpTest(cros_test_lib.OutputTestCase): |
| 25 | """Test the dumping functionality of cros_show_waterfall_layout.""" |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 26 | |
| 27 | def setUp(self): |
| 28 | bin_name = os.path.basename(__file__).rstrip('_unittest.py') |
| 29 | self.bin_path = os.path.join(constants.CHROMITE_BIN_DIR, bin_name) |
| 30 | |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 31 | def testTextDump(self): |
| 32 | """Make sure text dumping is capable of being produced.""" |
| 33 | with self.OutputCapturer() as output: |
Don Garrett | d2a6711 | 2018-12-04 18:26:47 -0800 | [diff] [blame] | 34 | cros_show_waterfall_layout.main([]) |
Dan Jacques | 2bcefd2 | 2015-05-18 14:57:00 -0700 | [diff] [blame] | 35 | self.assertFalse(not output.GetStdout()) |