Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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: Canonical link: https://commits.webkit.org/42707@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51278 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
118 additions
and 0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,46 @@ | ||
# 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.queries import * | ||
from modules.mock_bugzillatool import * | ||
|
||
class QueryCommandsTest(unittest.TestCase): | ||
def test_bugs_to_commit(self): | ||
BugsToCommit().execute(None, None, MockBugzillaTool()) | ||
|
||
def test_patches_to_commit(self): | ||
PatchesToCommit().execute(None, None, MockBugzillaTool()) | ||
|
||
def test_reviewed_patches(self): | ||
args = [42] | ||
ReviewedPatches().execute(None, args, MockBugzillaTool()) | ||
|
||
def test_tree_status(self): | ||
TreeStatus().execute(None, None, MockBugzillaTool()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,58 @@ | ||
# 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. | ||
|
||
class MockBugzilla(): | ||
patch1 = { "id": 197, "bug_id": 42, "url": "http://example.com/197" } | ||
patch2 = { "id": 128, "bug_id": 42, "url": "http://example.com/128" } | ||
|
||
def fetch_bug_ids_from_commit_queue(self): | ||
return [42, 75] | ||
|
||
def fetch_patches_from_commit_queue(self): | ||
return [self.patch1, self.patch2] | ||
|
||
def fetch_reviewed_patches_from_bug(self, bug_id): | ||
if bug_id == 42: | ||
return [self.patch1, self.patch2] | ||
return None | ||
|
||
|
||
class MockBuildBot(): | ||
def builder_statuses(self): | ||
return [{ | ||
"name": "Builder1", | ||
"is_green": True | ||
}, { | ||
"name": "Builder2", | ||
"is_green": True | ||
}] | ||
|
||
|
||
class MockBugzillaTool(): | ||
bugs = MockBugzilla() | ||
buildbot = MockBuildBot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters