OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
11 # in the documentation and/or other materials provided with the | 11 # in the documentation and/or other materials provided with the |
12 # distribution. | 12 # distribution. |
13 # * Neither the name of Google Inc. nor the names of its | 13 # * Neither the name of Google Inc. nor the names of its |
14 # contributors may be used to endorse or promote products derived from | 14 # contributors may be used to endorse or promote products derived from |
15 # this software without specific prior written permission. | 15 # this software without specific prior written permission. |
16 # | 16 # |
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
(...skipping 23 matching lines...) Expand all Loading... |
50 options = self._step_options() | 50 options = self._step_options() |
51 if not state: | 51 if not state: |
52 state = {} | 52 state = {} |
53 step(tool, options).run(state) | 53 step(tool, options).run(state) |
54 | 54 |
55 def test_prompt_for_bug_or_title_step(self): | 55 def test_prompt_for_bug_or_title_step(self): |
56 tool = MockTool() | 56 tool = MockTool() |
57 tool.user.prompt = lambda message: 50000 | 57 tool.user.prompt = lambda message: 50000 |
58 self._run_step(steps.PromptForBugOrTitle, tool=tool) | 58 self._run_step(steps.PromptForBugOrTitle, tool=tool) |
59 | 59 |
60 def _post_diff_options(self): | |
61 options = self._step_options() | |
62 options.git_commit = None | |
63 options.description = None | |
64 options.comment = None | |
65 options.review = True | |
66 options.request_commit = False | |
67 options.open_bug = True | |
68 return options | |
69 | |
70 def _assert_step_output_with_bug(self, step, bug_id, expected_logs, options=
None): | 60 def _assert_step_output_with_bug(self, step, bug_id, expected_logs, options=
None): |
71 state = {'bug_id': bug_id} | 61 state = {'bug_id': bug_id} |
72 OutputCapture().assert_outputs(self, self._run_step, [step, MockTool(),
options, state], expected_logs=expected_logs) | 62 OutputCapture().assert_outputs(self, self._run_step, [step, MockTool(),
options, state], expected_logs=expected_logs) |
73 | 63 |
74 def _assert_post_diff_output_for_bug(self, step, bug_id, expected_logs): | |
75 self._assert_step_output_with_bug(step, bug_id, expected_logs, self._pos
t_diff_options()) | |
76 | |
77 def test_post_diff(self): | |
78 expected_logs = "MOCK add_patch_to_bug: bug_id=78, description=Patch, ma
rk_for_review=True, mark_for_commit_queue=False, mark_for_landing=False\nMOCK: u
ser.open_url: http://example.com/78\n" | |
79 self._assert_post_diff_output_for_bug(steps.PostDiff, 78, expected_logs) | |
80 | |
81 def test_post_diff_for_commit(self): | |
82 expected_logs = "MOCK add_patch_to_bug: bug_id=78, description=Patch for
landing, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=T
rue\n" | |
83 self._assert_post_diff_output_for_bug(steps.PostDiffForCommit, 78, expec
ted_logs) | |
84 | |
85 def test_ensure_bug_is_open_and_assigned(self): | |
86 expected_logs = "MOCK reopen_bug 50004 with comment 'Reopening to attach
new patch.'\n" | |
87 self._assert_step_output_with_bug(steps.EnsureBugIsOpenAndAssigned, 5000
4, expected_logs) | |
88 expected_logs = "MOCK reassign_bug: bug_id=50002, assignee=None\n" | |
89 self._assert_step_output_with_bug(steps.EnsureBugIsOpenAndAssigned, 5000
2, expected_logs) | |
90 | |
91 def test_runtests_args(self): | 64 def test_runtests_args(self): |
92 mock_options = self._step_options() | 65 mock_options = self._step_options() |
93 mock_options.non_interactive = False | 66 mock_options.non_interactive = False |
94 step = steps.RunTests(MockTool(log_executive=True), mock_options) | 67 step = steps.RunTests(MockTool(log_executive=True), mock_options) |
95 tool = MockTool(log_executive=True) | 68 tool = MockTool(log_executive=True) |
96 # FIXME: We shouldn't use a real port-object here, but there is too much
to mock at the moment. | 69 # FIXME: We shouldn't use a real port-object here, but there is too much
to mock at the moment. |
97 tool._deprecated_port = DeprecatedPort() | 70 tool._deprecated_port = DeprecatedPort() |
98 step = steps.RunTests(tool, mock_options) | 71 step = steps.RunTests(tool, mock_options) |
99 expected_logs = """Running Python unit tests | 72 expected_logs = """Running Python unit tests |
100 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'], cwd=/mock-checkout | 73 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitpy'], cwd=/mock-checkout |
101 Running Perl unit tests | 74 Running Perl unit tests |
102 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'], cwd=/mock-checkou
t | 75 MOCK run_and_throw_if_fail: ['Tools/Scripts/test-webkitperl'], cwd=/mock-checkou
t |
103 Running bindings generation tests | 76 Running bindings generation tests |
104 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-bindings-tests'], cwd=/mock-chec
kout | 77 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-bindings-tests'], cwd=/mock-chec
kout |
105 Running run-webkit-tests | 78 Running run-webkit-tests |
106 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--quiet'], cwd=/
mock-checkout | 79 MOCK run_and_throw_if_fail: ['Tools/Scripts/run-webkit-tests', '--quiet'], cwd=/
mock-checkout |
107 """ | 80 """ |
108 OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expec
ted_logs) | 81 OutputCapture().assert_outputs(self, step.run, [{}], expected_logs=expec
ted_logs) |
OLD | NEW |