blob: 42b3fd7f2fb5b58ff03f343fac2c58d5ce363982 [file] [log] [blame]
Mike Frysingere58c0e22017-10-04 15:43:30 -04001# -*- coding: utf-8 -*-
Dan Jacques2bcefd22015-05-18 14:57:00 -07002# 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
8from __future__ import print_function
9
10import json
11import os
12
Aviv Keshetb7519e12016-10-04 00:50:00 -070013from chromite.lib import constants
Dan Jacques2bcefd22015-05-18 14:57:00 -070014from chromite.lib import cros_test_lib
15from chromite.scripts import cros_show_waterfall_layout
16
17# pylint: disable=protected-access
18
19
20class JsonDumpTest(cros_test_lib.OutputTestCase):
21 """Test the json dumping functionality of cbuildbot_view_config."""
22
23 def setUp(self):
24 bin_name = os.path.basename(__file__).rstrip('_unittest.py')
25 self.bin_path = os.path.join(constants.CHROMITE_BIN_DIR, bin_name)
26
27 def testJSONDumpLoadable(self):
28 """Make sure config export functionality works."""
29 with self.OutputCapturer() as output:
30 cros_show_waterfall_layout.main(['--format', 'json'])
31 layout = json.loads(output.GetStdout())
32 self.assertFalse(not layout)
33
34 def testTextDump(self):
35 """Make sure text dumping is capable of being produced."""
36 with self.OutputCapturer() as output:
37 cros_show_waterfall_layout.main(['--format', 'text'])
38 self.assertFalse(not output.GetStdout())