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

Unified Diff: appengine/findit/handlers/flake/test/check_flake_test.py

Issue 2195473002: [Findit] Dashboards and graph for regression range (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: addressed comments, got code coverage 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
Index: appengine/findit/handlers/flake/test/check_flake_test.py
diff --git a/appengine/findit/handlers/flake/test/check_flake_test.py b/appengine/findit/handlers/flake/test/check_flake_test.py
index f36aa7673b5e1959d5c5b2dae5849a47e594bbe4..af894ac22b6fe25a94a6a721644342dc34a94c19 100644
--- a/appengine/findit/handlers/flake/test/check_flake_test.py
+++ b/appengine/findit/handlers/flake/test/check_flake_test.py
@@ -1,11 +1,10 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
lijeffrey 2016/08/01 18:58:39 is there a reason for removing this?
caiw 2016/08/01 19:24:57 dunno how that happened... re-added.
-
import webapp2
from handlers.flake import check_flake
+
from waterfall.test import wf_testcase
+from model.flake.master_flake_analysis import MasterFlakeAnalysis
+from model import analysis_status
class CheckFlakeTest(wf_testcase.WaterfallTestCase):
@@ -13,13 +12,52 @@ class CheckFlakeTest(wf_testcase.WaterfallTestCase):
('/waterfall/check-flake', check_flake.CheckFlake),
], debug=True)
- def testBasicFlow(self):
+ def _CreateAndSaveMasterFlakeAnalysis(
+ self, master_name, builder_name, build_number,
+ step_name, test_name, status):
+ analysis = MasterFlakeAnalysis.Create(
+ master_name, builder_name, build_number, step_name, test_name)
+ analysis.status = status
+ analysis.put()
+ return analysis
+
+ def setUp(self):
+ super(CheckFlakeTest, self).setUp()
+
+ def testBasicFlowNoData(self):
+ master_name = 'm'
+ builder_name = 'b'
+ build_number = '123'
+ step_name = 's'
+ test_name = 't'
+
+ self.mock_current_user(user_email='test@chromium.org', is_admin=True)
+
+ response = self.test_app.get('/waterfall/check-flake', params={
+ 'master_name': master_name,
+ 'builder_name': builder_name,
+ 'build_number': build_number,
+ 'step_name': step_name,
+ 'test_name': test_name})
+
+ self.assertEquals(200, response.status_int)
+
+ def testBasicFlowWithData(self):
master_name = 'm'
builder_name = 'b'
build_number = '123'
step_name = 's'
test_name = 't'
+ status = analysis_status.PENDING
+
+ master_flake_analysis = self._CreateAndSaveMasterFlakeAnalysis(
+ master_name, builder_name, build_number, step_name,
+ test_name, status)
+ master_flake_analysis.build_numbers.append(123)
+ master_flake_analysis.success_rates.append(.9)
+ master_flake_analysis.put()
+
self.mock_current_user(user_email='test@chromium.org', is_admin=True)
response = self.test_app.get('/waterfall/check-flake', params={
@@ -28,4 +66,5 @@ class CheckFlakeTest(wf_testcase.WaterfallTestCase):
'build_number': build_number,
'step_name': step_name,
'test_name': test_name})
+
self.assertEquals(200, response.status_int)

Powered by Google App Engine
This is Rietveld 408576698