2009-11-25 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Nov 2009 03:02:48 +0000 (03:02 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Nov 2009 03:02:48 +0000 (03:02 +0000)
        Reviewed by Eric Seidel.

        Add unit test for mark-fixed
        https://bugs.webkit.org/show_bug.cgi?id=31896

        * Scripts/modules/commands/commandtest.py: Added.
        * Scripts/modules/commands/queries_unittest.py:
        * Scripts/modules/commands/upload_unittest.py: Added.
        * Scripts/modules/mock_bugzillatool.py:
        * Scripts/run-webkit-unittests:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/modules/commands/commandtest.py [new file with mode: 0644]
WebKitTools/Scripts/modules/commands/queries_unittest.py
WebKitTools/Scripts/modules/commands/upload_unittest.py [new file with mode: 0644]
WebKitTools/Scripts/modules/mock_bugzillatool.py
WebKitTools/Scripts/run-webkit-unittests

index ec342c04f5e4b20eb206629485ad9df7acf832ad..0a77a7be446291a4bd8adca48875b80393a88bec 100644 (file)
@@ -1,3 +1,16 @@
+2009-11-25  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Add unit test for mark-fixed
+        https://bugs.webkit.org/show_bug.cgi?id=31896
+
+        * Scripts/modules/commands/commandtest.py: Added.
+        * Scripts/modules/commands/queries_unittest.py:
+        * Scripts/modules/commands/upload_unittest.py: Added.
+        * Scripts/modules/mock_bugzillatool.py:
+        * Scripts/run-webkit-unittests:
+
 2009-11-25  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/Scripts/modules/commands/commandtest.py b/WebKitTools/Scripts/modules/commands/commandtest.py
new file mode 100644 (file)
index 0000000..5532b26
--- /dev/null
@@ -0,0 +1,41 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+from modules.mock_bugzillatool import MockBugzillaTool
+from modules.outputcapture import OutputCapture
+
+class CommandsTest(unittest.TestCase):
+    def assert_execute_outputs(self, command, command_args, expected_stdout, expected_stderr=""):
+        capture = OutputCapture()
+        capture.capture_output()
+        command.execute(None, command_args, MockBugzillaTool())
+        (stdout_string, stderr_string) = capture.restore_output()
+        self.assertEqual(stdout_string, expected_stdout)
+        self.assertEqual(expected_stderr, expected_stderr)
index d081c529b73c38c1cf3225242ced09d03ee41031..90f565aaf1f0341dce2d5812639d42adc2dd896c 100644 (file)
 
 import unittest
 
+from modules.commands.commandtest import CommandsTest
 from modules.commands.queries import *
-from modules.mock_bugzillatool import *
-from modules.outputcapture import OutputCapture
-
-class QueryCommandsTest(unittest.TestCase):
-    def _assert_execute_outputs(self, command, command_args, expected_stdout, expected_stderr = ""):
-        capture = OutputCapture()
-        capture.capture_output()
-        command.execute(None, command_args, MockBugzillaTool())
-        (stdout_string, stderr_string) = capture.restore_output()
-        self.assertEqual(stdout_string, expected_stdout)
-        self.assertEqual(expected_stderr, expected_stderr)
 
+class QueryCommandsTest(CommandsTest):
     def test_bugs_to_commit(self):
-        self._assert_execute_outputs(BugsToCommit(), None, "42\n75\n")
+        self.assert_execute_outputs(BugsToCommit(), None, "42\n75\n")
 
     def test_patches_to_commit(self):
         expected_stdout = "http://example.com/197\nhttp://example.com/128\n"
         expected_stderr = "Patches in commit queue:\n"
-        self._assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr)
+        self.assert_execute_outputs(PatchesToCommit(), None, expected_stdout, expected_stderr)
 
     def test_reviewed_patches(self):
         expected_stdout = "http://example.com/197\nhttp://example.com/128\n"
-        self._assert_execute_outputs(ReviewedPatches(), [42], expected_stdout)
+        self.assert_execute_outputs(ReviewedPatches(), [42], expected_stdout)
 
     def test_tree_status(self):
         expected_stdout = "ok   : Builder1\nok   : Builder2\n"
-        self._assert_execute_outputs(TreeStatus(), None, expected_stdout)
+        self.assert_execute_outputs(TreeStatus(), None, expected_stdout)
diff --git a/WebKitTools/Scripts/modules/commands/upload_unittest.py b/WebKitTools/Scripts/modules/commands/upload_unittest.py
new file mode 100644 (file)
index 0000000..093ebe3
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+from modules.commands.commandtest import CommandsTest
+from modules.commands.upload import *
+
+class UploadCommandsTest(CommandsTest):
+    def test_mark_fixed(self):
+        self.assert_execute_outputs(MarkFixed(), [43, "Test comment"], "", "")
index d00538c3fa2938f10280d27aee44cae57649eb0a..4399763f848390ed29c611ce7d9efff78a4c351d 100644 (file)
@@ -41,6 +41,9 @@ class MockBugzilla():
             return [self.patch1, self.patch2]
         return None
 
+    def close_bug_as_fixed(self, bug_id, comment_text=None):
+        pass
+
 
 class MockBuildBot():
     def builder_statuses(self):
index 933bbdc570e82c6b9402916e4d4698d08ef6cf9a..f447dfa98fa69c20c913f12fcc1d8e005ca7cfd9 100755 (executable)
@@ -32,6 +32,7 @@ import unittest
 from modules.bugzilla_unittest import *
 from modules.buildbot_unittest import *
 from modules.changelogs_unittest import *
+from modules.commands.upload_unittest import *
 from modules.commands.queries_unittest import *
 from modules.committers_unittest import *
 from modules.cpp_style_unittest import *