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

Side by Side Diff: appengine/findit/handlers/test/try_job_dashboard_test.py

Issue 2605803002: [Findit] Refactoring WfTryJobData into BaseTryJobData, WfTryJobData, and FlakeTryJobData (Closed)
Patch Set: Fixing code coverage Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | appengine/findit/model/base_try_job.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime 5 from datetime import datetime
6 from datetime import timedelta
7 import json 6 import json
8 7
9 import webapp2 8 import webapp2
10 9
11 from handlers import try_job_dashboard 10 from handlers import try_job_dashboard
11 from model.wf_try_job import WfTryJob
12 from model.wf_try_job_data import WfTryJobData 12 from model.wf_try_job_data import WfTryJobData
13 13
14 from testing_utils import testing 14 from testing_utils import testing
15 15
16 16
17 class TryJobDashboardTest(testing.AppengineTestCase): 17 class TryJobDashboardTest(testing.AppengineTestCase):
18 app_module = webapp2.WSGIApplication([ 18 app_module = webapp2.WSGIApplication([
19 ('/try-job-dashboard', try_job_dashboard.TryJobDashboard), 19 ('/try-job-dashboard', try_job_dashboard.TryJobDashboard),
20 ], debug=True) 20 ], debug=True)
21 21
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 self.assertEqual( 70 self.assertEqual(
71 try_job_dashboard._PrepareBuildbucketResponseForDisplay( 71 try_job_dashboard._PrepareBuildbucketResponseForDisplay(
72 buildbucket_response), 72 buildbucket_response),
73 { 73 {
74 'blabla': 'blabla', 74 'blabla': 'blabla',
75 'has_json': properties 75 'has_json': properties
76 }) 76 })
77 77
78 def testGet(self): 78 def testGet(self):
79 try_job_in_progress = WfTryJobData.Create(1) 79 try_job_in_progress = WfTryJobData.Create(1)
80 try_job_in_progress.master_name = 'm' 80 try_job_in_progress.try_job_key = WfTryJob.Create('m', 'b', 1).key
81 try_job_in_progress.builder_name = 'b'
82 try_job_in_progress.build_number = 1
83 try_job_in_progress.try_job_type = 'compile' 81 try_job_in_progress.try_job_type = 'compile'
84 try_job_in_progress.start_time = datetime(2016, 5, 4, 0, 0, 1) 82 try_job_in_progress.start_time = datetime(2016, 5, 4, 0, 0, 1)
85 try_job_in_progress.request_time = datetime(2016, 5, 4, 0, 0, 0) 83 try_job_in_progress.request_time = datetime(2016, 5, 4, 0, 0, 0)
86 try_job_in_progress.try_job_url = 'url1' 84 try_job_in_progress.try_job_url = 'url1'
87 try_job_in_progress.last_buildbucket_response = {'status': 'STARTED'} 85 try_job_in_progress.last_buildbucket_response = {'status': 'STARTED'}
88 try_job_in_progress.put() 86 try_job_in_progress.put()
89 87
90 try_job_with_error = WfTryJobData.Create(2) 88 try_job_with_error = WfTryJobData.Create(2)
91 try_job_with_error.master_name = 'm' 89 try_job_with_error.try_job_key = WfTryJob.Create('m', 'b', 2).key
92 try_job_with_error.builder_name = 'b'
93 try_job_with_error.build_number = 2
94 try_job_with_error.try_job_type = 'compile' 90 try_job_with_error.try_job_type = 'compile'
95 try_job_with_error.start_time = datetime(2016, 5, 4, 0, 0, 1) 91 try_job_with_error.start_time = datetime(2016, 5, 4, 0, 0, 1)
96 try_job_with_error.request_time = datetime(2016, 5, 4, 0, 0, 0) 92 try_job_with_error.request_time = datetime(2016, 5, 4, 0, 0, 0)
97 try_job_with_error.end_time = datetime(2016, 5, 4, 0, 0, 2) 93 try_job_with_error.end_time = datetime(2016, 5, 4, 0, 0, 2)
98 try_job_with_error.try_job_url = 'url2' 94 try_job_with_error.try_job_url = 'url2'
99 try_job_with_error.error = { 95 try_job_with_error.error = {
100 'message': 'some error', 96 'message': 'some error',
101 'reason': 'some reason' 97 'reason': 'some reason'
102 } 98 }
103 try_job_with_error.last_buildbucket_response = { 99 try_job_with_error.last_buildbucket_response = {
104 'failure_reason': 'INFRA_FAILURE' 100 'failure_reason': 'INFRA_FAILURE'
105 } 101 }
106 try_job_with_error.put() 102 try_job_with_error.put()
107 103
108 try_job_completed = WfTryJobData.Create(3) 104 try_job_completed = WfTryJobData.Create(3)
109 try_job_completed.master_name = 'm' 105 try_job_completed.try_job_key = WfTryJob.Create('m', 'b', 3).key
110 try_job_completed.builder_name = 'b'
111 try_job_completed.build_number = 3
112 try_job_completed.try_job_type = 'compile' 106 try_job_completed.try_job_type = 'compile'
113 try_job_completed.start_time = datetime(2016, 5, 4, 0, 0, 1) 107 try_job_completed.start_time = datetime(2016, 5, 4, 0, 0, 1)
114 try_job_completed.request_time = datetime(2016, 5, 4, 0, 0, 0) 108 try_job_completed.request_time = datetime(2016, 5, 4, 0, 0, 0)
115 try_job_completed.end_time = datetime(2016, 5, 4, 0, 0, 2) 109 try_job_completed.end_time = datetime(2016, 5, 4, 0, 0, 2)
116 try_job_completed.try_job_url = 'url3' 110 try_job_completed.try_job_url = 'url3'
117 try_job_completed.culprits = { 111 try_job_completed.culprits = {
118 'compile': { 112 'compile': {
119 '12345': 'failed' 113 '12345': 'failed'
120 } 114 }
121 } 115 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 self.assertEqual(response.status_int, 200) 162 self.assertEqual(response.status_int, 200)
169 self.validateTryJobDisplayData( 163 self.validateTryJobDisplayData(
170 [expected_try_job_in_progress_display_data], 164 [expected_try_job_in_progress_display_data],
171 try_jobs_in_progress) 165 try_jobs_in_progress)
172 self.validateTryJobDisplayData( 166 self.validateTryJobDisplayData(
173 [expected_try_job_with_error_display_data], 167 [expected_try_job_with_error_display_data],
174 try_jobs_with_error) 168 try_jobs_with_error)
175 self.validateTryJobDisplayData( 169 self.validateTryJobDisplayData(
176 [expected_try_job_completed_display_data], 170 [expected_try_job_completed_display_data],
177 successfully_completed_try_jobs) 171 successfully_completed_try_jobs)
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/model/base_try_job.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698