Changeset 51278 in webkit


Ignore:
Timestamp:
Nov 20, 2009 8:06:06 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-11-20 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Unit test query commands
https://bugs.webkit.org/show_bug.cgi?id=31755

These tests are pretty rough, but hopefully they'll grow.

  • Scripts/modules/commands/queries_unittest.py: Added.
  • Scripts/modules/mock_bugzillatool.py: Added.
  • Scripts/run-webkit-unittests:
Location:
trunk/WebKitTools
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51277 r51278  
     12009-11-20  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Unit test query commands
     6        https://bugs.webkit.org/show_bug.cgi?id=31755
     7
     8        These tests are pretty rough, but hopefully they'll grow.
     9
     10        * Scripts/modules/commands/queries_unittest.py: Added.
     11        * Scripts/modules/mock_bugzillatool.py: Added.
     12        * Scripts/run-webkit-unittests:
     13
    1142009-11-20  Eric Seidel  <eric@webkit.org>
    215
  • trunk/WebKitTools/Scripts/modules/commands/queries_unittest.py

    • Property svn:executable deleted
    r51277 r51278  
    1 #!/usr/bin/env python
    2 # Copyright (c) 2009 Google Inc. All rights reserved.
     1# Copyright (C) 2009 Google Inc. All rights reserved.
    32#
    43# Redistribution and use in source and binary forms, with or without
    54# modification, are permitted provided that the following conditions are
    65# met:
    7 # 
    8 #     * Redistributions of source code must retain the above copyright
     6#
     7#    * Redistributions of source code must retain the above copyright
    98# notice, this list of conditions and the following disclaimer.
    10 #     * Redistributions in binary form must reproduce the above
     9#    * Redistributions in binary form must reproduce the above
    1110# copyright notice, this list of conditions and the following disclaimer
    1211# in the documentation and/or other materials provided with the
    1312# distribution.
    14 #     * Neither the name of Google Inc. nor the names of its
     13#    * Neither the name of Google Inc. nor the names of its
    1514# contributors may be used to endorse or promote products derived from
    1615# this software without specific prior written permission.
    17 # 
     16#
    1817# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1918# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    3029import unittest
    3130
    32 from modules.bugzilla_unittest import *
    33 from modules.buildbot_unittest import *
    34 from modules.changelogs_unittest import *
    35 from modules.committers_unittest import *
    36 from modules.cpp_style_unittest import *
    37 from modules.diff_parser_unittest import *
    38 from modules.logging_unittest import *
    39 from modules.multicommandtool_unittest import *
    40 from modules.patchcollection_unittest import *
    41 from modules.scm_unittest import *
    42 from modules.webkitport_unittest import *
    43 from modules.workqueue_unittest import *
     31from modules.commands.queries import *
     32from modules.mock_bugzillatool import *
    4433
    45 if __name__ == "__main__":
    46     unittest.main()
     34class QueryCommandsTest(unittest.TestCase):
     35    def test_bugs_to_commit(self):
     36        BugsToCommit().execute(None, None, MockBugzillaTool())
     37
     38    def test_patches_to_commit(self):
     39        PatchesToCommit().execute(None, None, MockBugzillaTool())
     40
     41    def test_reviewed_patches(self):
     42        args = [42]
     43        ReviewedPatches().execute(None, args, MockBugzillaTool())
     44
     45    def test_tree_status(self):
     46        TreeStatus().execute(None, None, MockBugzillaTool())
  • trunk/WebKitTools/Scripts/modules/mock_bugzillatool.py

    • Property svn:executable deleted
    r51277 r51278  
    1 #!/usr/bin/env python
    2 # Copyright (c) 2009 Google Inc. All rights reserved.
     1# Copyright (C) 2009 Google Inc. All rights reserved.
    32#
    43# Redistribution and use in source and binary forms, with or without
    54# modification, are permitted provided that the following conditions are
    65# met:
    7 # 
    8 #     * Redistributions of source code must retain the above copyright
     6#
     7#    * Redistributions of source code must retain the above copyright
    98# notice, this list of conditions and the following disclaimer.
    10 #     * Redistributions in binary form must reproduce the above
     9#    * Redistributions in binary form must reproduce the above
    1110# copyright notice, this list of conditions and the following disclaimer
    1211# in the documentation and/or other materials provided with the
    1312# distribution.
    14 #     * Neither the name of Google Inc. nor the names of its
     13#    * Neither the name of Google Inc. nor the names of its
    1514# contributors may be used to endorse or promote products derived from
    1615# this software without specific prior written permission.
    17 # 
     16#
    1817# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1918# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    2827# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2928
    30 import unittest
     29class 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" }
    3132
    32 from modules.bugzilla_unittest import *
    33 from modules.buildbot_unittest import *
    34 from modules.changelogs_unittest import *
    35 from modules.committers_unittest import *
    36 from modules.cpp_style_unittest import *
    37 from modules.diff_parser_unittest import *
    38 from modules.logging_unittest import *
    39 from modules.multicommandtool_unittest import *
    40 from modules.patchcollection_unittest import *
    41 from modules.scm_unittest import *
    42 from modules.webkitport_unittest import *
    43 from modules.workqueue_unittest import *
     33    def fetch_bug_ids_from_commit_queue(self):
     34        return [42, 75]
    4435
    45 if __name__ == "__main__":
    46     unittest.main()
     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
     45class 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
     56class MockBugzillaTool():
     57    bugs = MockBugzilla()
     58    buildbot = MockBuildBot()
  • trunk/WebKitTools/Scripts/run-webkit-unittests

    r51231 r51278  
    3333from modules.buildbot_unittest import *
    3434from modules.changelogs_unittest import *
     35from modules.commands.queries_unittest import *
    3536from modules.committers_unittest import *
    3637from modules.cpp_style_unittest import *
Note: See TracChangeset for help on using the changeset viewer.