blob: 49a7f48cdedd5076f014d026c90fbe40e1b8f39f [file] [log] [blame]
Dan Jacques2bcefd22015-05-18 14:57:00 -07001# Copyright 2015 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Unittests for cros_show_waterfall_layout."""
6
7from __future__ import print_function
8
9import json
10import os
11
12from chromite.cbuildbot import constants
13from chromite.lib import cros_test_lib
14from chromite.scripts import cros_show_waterfall_layout
15
16# pylint: disable=protected-access
17
18
19class JsonDumpTest(cros_test_lib.OutputTestCase):
20 """Test the json dumping functionality of cbuildbot_view_config."""
21
22 def setUp(self):
23 bin_name = os.path.basename(__file__).rstrip('_unittest.py')
24 self.bin_path = os.path.join(constants.CHROMITE_BIN_DIR, bin_name)
25
26 def testJSONDumpLoadable(self):
27 """Make sure config export functionality works."""
28 with self.OutputCapturer() as output:
29 cros_show_waterfall_layout.main(['--format', 'json'])
30 layout = json.loads(output.GetStdout())
31 self.assertFalse(not layout)
32
33 def testTextDump(self):
34 """Make sure text dumping is capable of being produced."""
35 with self.OutputCapturer() as output:
36 cros_show_waterfall_layout.main(['--format', 'text'])
37 self.assertFalse(not output.GetStdout())