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

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

Issue 2158533002: [Findit] Use unittest.mock for testing and create a shared method to mock pipeline. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 5 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/test/build_failure_analysis_pipelines_test.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 722f845c42aac4ca1f61b83e66553c1ab5f1ae08..4bbd321d414406ea8e833ef6fc808437814fb558 100644
--- a/appengine/findit/waterfall/test/buildbot_test.py
+++ b/appengine/findit/waterfall/test/buildbot_test.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
from datetime import datetime
+import mock
import os
import unittest
@@ -146,12 +147,12 @@ class BuildBotTest(unittest.TestCase):
build_number = 1
expected_url = ('https://chrome-build-extract.appspot.com/p/a/builders/'
'b%20c/builds/1?json=1')
- http_client = DummyHttpClient(200, 'abc')
+ http_client = mock.create_autospec(RetryHttpClient)
+ http_client.Get.return_value = (200, 'abc')
data = buildbot.GetBuildDataFromArchive(
master_name, builder_name, build_number, http_client)
- self.assertEqual(http_client.response_content, data)
- self.assertEqual(1, len(http_client.requests))
- self.assertEqual(expected_url, http_client.requests[0])
+ self.assertEqual('abc', data)
+ http_client.assert_has_calls([mock.call.Get(expected_url)])
def testGetBuildDataFromArchiveFailure(self):
master_name = 'a'
« no previous file with comments | « appengine/findit/waterfall/test/build_failure_analysis_pipelines_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698