1231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# Copyright (C) 2009 Google Inc. All rights reserved.
2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#
3231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# Redistribution and use in source and binary forms, with or without
4231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# modification, are permitted provided that the following conditions are
5231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# met:
6643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#
7643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#    * Redistributions of source code must retain the above copyright
8231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# notice, this list of conditions and the following disclaimer.
9643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#    * Redistributions in binary form must reproduce the above
10231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# copyright notice, this list of conditions and the following disclaimer
11231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# in the documentation and/or other materials provided with the
12231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# distribution.
13643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#    * Neither the name of Google Inc. nor the names of its
14231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# contributors may be used to endorse or promote products derived from
15231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# this software without specific prior written permission.
16643ca7872b450ea4efacab6188849e5aac2ba161Steve Block#
17231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
29643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockimport unittest
30231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
31dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockfrom webkitpy.common.system.outputcapture import OutputCapture
32e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkefrom webkitpy.tool.mocktool import MockOptions, MockTool
33231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
34643ca7872b450ea4efacab6188849e5aac2ba161Steve Blockclass CommandsTest(unittest.TestCase):
352fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    def assert_execute_outputs(self, command, args, expected_stdout="", expected_stderr="", expected_exception=None, options=MockOptions(), tool=MockTool()):
36f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch        options.blocks = None
37a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.cc = 'MOCK cc'
38a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.component = 'MOCK component'
39a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.confirm = True
40a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.email = 'MOCK email'
41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.git_commit = 'MOCK git commit'
42a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.obsolete_patches = True
43a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.open_bug = True
44a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.port = 'MOCK port'
45a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.quiet = True
46a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch        options.reviewer = 'MOCK reviewer'
47d0825bca7fe65beaee391d30da42e937db621564Steve Block        command.bind_to_tool(tool)
482fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        OutputCapture().assert_outputs(self, command.execute, [options, args, tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr, expected_exception=expected_exception)
49