| 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 """This module is to handle manual triage of a suspected flake result. | 5 """This module is to handle manual triage of a suspected flake result. |
| 6 | 6 |
| 7 This handler will mark the suspected flake result as correct or incorrect. | 7 This handler will mark the suspected flake result as correct or incorrect. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 from google.appengine.api import users | 10 from google.appengine.api import users |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 master_flake_analysis.UpdateTriageResult( | 31 master_flake_analysis.UpdateTriageResult( |
| 32 triage_result, suspect_info, user_name, version_number) | 32 triage_result, suspect_info, user_name, version_number) |
| 33 master_flake_analysis.put() | 33 master_flake_analysis.put() |
| 34 return True | 34 return True |
| 35 | 35 |
| 36 | 36 |
| 37 class TriageFlakeAnalysis(BaseHandler): | 37 class TriageFlakeAnalysis(BaseHandler): |
| 38 PERMISSION_LEVEL = Permission.CORP_USER | 38 PERMISSION_LEVEL = Permission.CORP_USER |
| 39 LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = False |
| 39 | 40 |
| 40 def HandleGet(self): # pragma: no cover | 41 def HandleGet(self): # pragma: no cover |
| 41 """Sets the manual triage result for the suspected flake analysis.""" | 42 """Sets the manual triage result for the suspected flake analysis.""" |
| 42 flake_info = self.request.get('flake_info') | 43 flake_info = self.request.get('flake_info') |
| 43 (master_name, builder_name, build_number, step_name, test_name, | 44 (master_name, builder_name, build_number, step_name, test_name, |
| 44 version_number, suspected_build_number) = flake_info.split('/') | 45 version_number, suspected_build_number) = flake_info.split('/') |
| 45 triage_result = self.request.get('triage_result') | 46 triage_result = self.request.get('triage_result') |
| 46 | 47 |
| 47 if not (master_name and builder_name and build_number and step_name and | 48 if not (master_name and builder_name and build_number and step_name and |
| 48 test_name and version_number and suspected_build_number and | 49 test_name and version_number and suspected_build_number and |
| 49 str(triage_result)): | 50 str(triage_result)): |
| 50 # All fields needed for getting master_flake_analysis must be provided in | 51 # All fields needed for getting master_flake_analysis must be provided in |
| 51 # order to update triage results. | 52 # order to update triage results. |
| 52 return {'data': {'success': False}} | 53 return {'data': {'success': False}} |
| 53 | 54 |
| 54 # As the permission level is CORP_USER, we could assume the current user | 55 # As the permission level is CORP_USER, we could assume the current user |
| 55 # already logged in. | 56 # already logged in. |
| 56 user_name = users.get_current_user().email().split('@')[0] | 57 user_name = users.get_current_user().email().split('@')[0] |
| 57 | 58 |
| 58 success = _UpdateSuspectedFlakeAnalysis( | 59 success = _UpdateSuspectedFlakeAnalysis( |
| 59 master_name, builder_name, build_number, step_name, test_name, | 60 master_name, builder_name, build_number, step_name, test_name, |
| 60 int(version_number), suspected_build_number, int(triage_result), | 61 int(version_number), suspected_build_number, int(triage_result), |
| 61 user_name) | 62 user_name) |
| 62 | 63 |
| 63 return {'data': {'success': success}} | 64 return {'data': {'success': success}} |
| 64 | 65 |
| 65 def HandlePost(self): # pragma: no cover | 66 def HandlePost(self): # pragma: no cover |
| 66 return self.HandleGet() | 67 return self.HandleGet() |
| OLD | NEW |