Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1755)

Unified Diff: appengine/findit/waterfall/test/buildbot_test.py

Issue 2400453002: [Findit] Retrieve recent builds of a given builder. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/waterfall/buildbot.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/test/buildbot_test.py
diff --git a/appengine/findit/waterfall/test/buildbot_test.py b/appengine/findit/waterfall/test/buildbot_test.py
index 223e5ec34a299aab49291b0722dc4efb651a7190..723a1247841f0ce55f8113d808a47cd92a8052de 100644
--- a/appengine/findit/waterfall/test/buildbot_test.py
+++ b/appengine/findit/waterfall/test/buildbot_test.py
@@ -35,6 +35,31 @@ class DummyHttpClient(RetryHttpClient):
class BuildBotTest(unittest.TestCase):
+ def testFailToGetRecentCompletedBuilds(self):
+ mocked_http_client = mock.Mock()
+ mocked_http_client.Get.side_effect = [(404, '404'), None]
+ self.assertEqual(
+ [], buildbot.GetRecentCompletedBuilds('m', 'b', mocked_http_client))
+ mocked_http_client.assert_has_calls(
+ mock.call('https://build.chromium.org/p/m/json/builders/'))
+
+ def testGetRecentCompletedBuilds(self):
+ builders_json_data = """
+ {
+ "b": {
+ "cachedBuilds": [33, 32, 34, 35],
+ "currentBuilds": [35]
+ }
+ }
+ """
+ mocked_http_client = mock.Mock()
+ mocked_http_client.Get.return_value = (200, builders_json_data)
+ self.assertEqual(
+ [34, 33, 32],
+ buildbot.GetRecentCompletedBuilds('m', 'b', mocked_http_client))
+ mocked_http_client.assert_has_calls(
+ mock.call('https://build.chromium.org/p/m/json/builders/'))
+
def testGetMasternameFromUrl(self):
cases = {
None: None,
« no previous file with comments | « appengine/findit/waterfall/buildbot.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698