Changeset 51405 in webkit
- Timestamp:
- Nov 25, 2009 7:02:48 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r51404 r51405 1 2009-11-25 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Add unit test for mark-fixed 6 https://bugs.webkit.org/show_bug.cgi?id=31896 7 8 * Scripts/modules/commands/commandtest.py: Added. 9 * Scripts/modules/commands/queries_unittest.py: 10 * Scripts/modules/commands/upload_unittest.py: Added. 11 * Scripts/modules/mock_bugzillatool.py: 12 * Scripts/run-webkit-unittests: 13 1 14 2009-11-25 Adam Barth <abarth@webkit.org> 2 15 -
trunk/WebKitTools/Scripts/modules/commands/commandtest.py
r51404 r51405 29 29 import unittest 30 30 31 from modules.commands.queries import * 32 from modules.mock_bugzillatool import * 31 from modules.mock_bugzillatool import MockBugzillaTool 33 32 from modules.outputcapture import OutputCapture 34 33 35 class QueryCommandsTest(unittest.TestCase):36 def _assert_execute_outputs(self, command, command_args, expected_stdout, expected_stderr =""):34 class CommandsTest(unittest.TestCase): 35 def assert_execute_outputs(self, command, command_args, expected_stdout, expected_stderr=""): 37 36 capture = OutputCapture() 38 37 capture.capture_output() … … 41 40 self.assertEqual(stdout_string, expected_stdout) 42 41 self.assertEqual(expected_stderr, expected_stderr) 43 44 def test_bugs_to_commit(self):45 self._assert_execute_outputs(BugsToCommit(), None, "42\n75\n")46 47 def test_patches_to_commit(self):48 expected_stdout = "http://example.com/197\nhttp://example.com/128\n"49 expected_stderr = "Patches in commit queue:\n"50 self._assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr)51 52 def test_reviewed_patches(self):53 expected_stdout = "http://example.com/197\nhttp://example.com/128\n"54 self._assert_execute_outputs(ReviewedPatches(), [42], expected_stdout)55 56 def test_tree_status(self):57 expected_stdout = "ok : Builder1\nok : Builder2\n"58 self._assert_execute_outputs(TreeStatus(), None, expected_stdout) -
trunk/WebKitTools/Scripts/modules/commands/queries_unittest.py
r51381 r51405 29 29 import unittest 30 30 31 from modules.commands.commandtest import CommandsTest 31 32 from modules.commands.queries import * 32 from modules.mock_bugzillatool import *33 from modules.outputcapture import OutputCapture34 33 35 class QueryCommandsTest(unittest.TestCase): 36 def _assert_execute_outputs(self, command, command_args, expected_stdout, expected_stderr = ""): 37 capture = OutputCapture() 38 capture.capture_output() 39 command.execute(None, command_args, MockBugzillaTool()) 40 (stdout_string, stderr_string) = capture.restore_output() 41 self.assertEqual(stdout_string, expected_stdout) 42 self.assertEqual(expected_stderr, expected_stderr) 43 34 class QueryCommandsTest(CommandsTest): 44 35 def test_bugs_to_commit(self): 45 self. _assert_execute_outputs(BugsToCommit(), None, "42\n75\n")36 self.assert_execute_outputs(BugsToCommit(), None, "42\n75\n") 46 37 47 38 def test_patches_to_commit(self): 48 39 expected_stdout = "http://example.com/197\nhttp://example.com/128\n" 49 40 expected_stderr = "Patches in commit queue:\n" 50 self. _assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr)41 self.assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr) 51 42 52 43 def test_reviewed_patches(self): 53 44 expected_stdout = "http://example.com/197\nhttp://example.com/128\n" 54 self. _assert_execute_outputs(ReviewedPatches(), [42], expected_stdout)45 self.assert_execute_outputs(ReviewedPatches(), [42], expected_stdout) 55 46 56 47 def test_tree_status(self): 57 48 expected_stdout = "ok : Builder1\nok : Builder2\n" 58 self. _assert_execute_outputs(TreeStatus(), None, expected_stdout)49 self.assert_execute_outputs(TreeStatus(), None, expected_stdout) -
trunk/WebKitTools/Scripts/modules/commands/upload_unittest.py
r51404 r51405 27 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 29 class MockBugzilla(): 30 patch1 = { "id": 197, "bug_id": 42, "url": "http://example.com/197" } 31 patch2 = { "id": 128, "bug_id": 42, "url": "http://example.com/128" } 29 import unittest 32 30 33 def fetch_bug_ids_from_commit_queue(self): 34 return [42, 75] 31 from modules.commands.commandtest import CommandsTest 32 from modules.commands.upload import * 35 33 36 def fetch_patches_from_commit_queue(self): 37 return [self.patch1, self.patch2] 38 39 def fetch_reviewed_patches_from_bug(self, bug_id): 40 if bug_id == 42: 41 return [self.patch1, self.patch2] 42 return None 43 44 45 class MockBuildBot(): 46 def builder_statuses(self): 47 return [{ 48 "name": "Builder1", 49 "is_green": True 50 }, { 51 "name": "Builder2", 52 "is_green": True 53 }] 54 55 56 class MockBugzillaTool(): 57 bugs = MockBugzilla() 58 buildbot = MockBuildBot() 34 class UploadCommandsTest(CommandsTest): 35 def test_mark_fixed(self): 36 self.assert_execute_outputs(MarkFixed(), [43, "Test comment"], "", "") -
trunk/WebKitTools/Scripts/modules/mock_bugzillatool.py
r51278 r51405 42 42 return None 43 43 44 def close_bug_as_fixed(self, bug_id, comment_text=None): 45 pass 46 44 47 45 48 class MockBuildBot(): -
trunk/WebKitTools/Scripts/run-webkit-unittests
r51278 r51405 33 33 from modules.buildbot_unittest import * 34 34 from modules.changelogs_unittest import * 35 from modules.commands.upload_unittest import * 35 36 from modules.commands.queries_unittest import * 36 37 from modules.committers_unittest import *
Note: See TracChangeset
for help on using the changeset viewer.