| OLD | NEW |
| 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 import datetime | 5 import datetime |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 import webapp2 | 8 import webapp2 |
| 9 import webtest | 9 import webtest |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 analysis.data_points.append(data_point) | 76 analysis.data_points.append(data_point) |
| 77 analysis.status = analysis_status.COMPLETED | 77 analysis.status = analysis_status.COMPLETED |
| 78 analysis.suspected_flake_build_number = 100 | 78 analysis.suspected_flake_build_number = 100 |
| 79 analysis.request_time = datetime.datetime(2016, 10, 01, 12, 10, 00) | 79 analysis.request_time = datetime.datetime(2016, 10, 01, 12, 10, 00) |
| 80 analysis.start_time = datetime.datetime(2016, 10, 01, 12, 10, 05) | 80 analysis.start_time = datetime.datetime(2016, 10, 01, 12, 10, 05) |
| 81 analysis.end_time = datetime.datetime(2016, 10, 01, 13, 10, 00) | 81 analysis.end_time = datetime.datetime(2016, 10, 01, 13, 10, 00) |
| 82 analysis.algorithm_parameters = {'iterations_to_rerun': 100} | 82 analysis.algorithm_parameters = {'iterations_to_rerun': 100} |
| 83 analysis.Save() | 83 analysis.Save() |
| 84 | 84 |
| 85 response = self.test_app.get('/waterfall/check-flake', params={ | 85 response = self.test_app.get('/waterfall/check-flake', params={ |
| 86 'master_name': master_name, | 86 'key': analysis.key.urlsafe(), |
| 87 'builder_name': builder_name, | |
| 88 'build_number': build_number, | |
| 89 'step_name': step_name, | |
| 90 'test_name': test_name, | |
| 91 'format': 'json'}) | 87 'format': 'json'}) |
| 92 | 88 |
| 93 expected_check_flake_result = { | 89 expected_check_flake_result = { |
| 94 'pass_rates': [[int(build_number), success_rate]], | 90 'pass_rates': [[int(build_number), success_rate]], |
| 95 'analysis_status': STATUS_TO_DESCRIPTION.get(analysis.status), | 91 'analysis_status': STATUS_TO_DESCRIPTION.get(analysis.status), |
| 96 'master_name': master_name, | 92 'master_name': master_name, |
| 97 'builder_name': builder_name, | 93 'builder_name': builder_name, |
| 98 'build_number': int(build_number), | 94 'build_number': int(build_number), |
| 99 'step_name': step_name, | 95 'step_name': step_name, |
| 100 'test_name': test_name, | 96 'test_name': test_name, |
| 101 'request_time': '2016-10-01 12:10:00 UTC', | 97 'request_time': '2016-10-01 12:10:00 UTC', |
| 102 'task_number': 1, | 98 'task_number': 1, |
| 103 'error': None, | 99 'error': None, |
| 104 'iterations_to_rerun': 100, | 100 'iterations_to_rerun': 100, |
| 105 'pending_time': '00:00:05', | 101 'pending_time': '00:00:05', |
| 106 'duration': '00:59:55', | 102 'duration': '00:59:55', |
| 107 'suspected_flake_build_number': 100, | 103 'suspected_flake_build_number': 100, |
| 108 } | 104 } |
| 109 | 105 |
| 110 self.assertEquals(200, response.status_int) | 106 self.assertEquals(200, response.status_int) |
| 111 self.assertEqual(expected_check_flake_result, response.json_body) | 107 self.assertEqual(expected_check_flake_result, response.json_body) |
| OLD | NEW |