Get the result for the testcase list page.
()
| 111 | |
| 112 | |
| 113 | def get_result(): |
| 114 | """Get the result for the testcase list page.""" |
| 115 | params = dict(request.iterparams()) |
| 116 | page = helpers.cast(request.get('page') or 1, int, "'page' is not an int.") |
| 117 | |
| 118 | query = datastore_query.Query(data_types.Testcase) |
| 119 | crash_access.add_scope(query, params, 'security_flag', 'job_type', |
| 120 | 'fuzzer_name_indices') |
| 121 | add_filters(query, params) |
| 122 | |
| 123 | testcases, total_pages, total_items, has_more = query.fetch_page( |
| 124 | page=page, page_size=PAGE_SIZE, projection=FIELDS, more_limit=MORE_LIMIT) |
| 125 | |
| 126 | items = [] |
| 127 | for testcase in testcases: |
| 128 | regression_range = '' |
| 129 | fixed_range = '' |
| 130 | |
| 131 | if testcase.regression and testcase.regression != 'NA': |
| 132 | regression_range = testcase.regression |
| 133 | if testcase.fixed and testcase.fixed != 'NA': |
| 134 | fixed_range = testcase.fixed |
| 135 | |
| 136 | item = { |
| 137 | 'id': testcase.key.id(), |
| 138 | 'crashType': ' '.join(testcase.crash_type.splitlines()), |
| 139 | 'crashStateLines': testcase.crash_state.strip().splitlines(), |
| 140 | 'jobType': testcase.job_type, |
| 141 | 'isClosed': not testcase.open, |
| 142 | 'isFixed': testcase.fixed and testcase.fixed != 'NA', |
| 143 | 'isReproducible': not testcase.one_time_crasher_flag, |
| 144 | 'isSecurity': testcase.security_flag, |
| 145 | 'isImpactSet': testcase.is_impact_set_flag, |
| 146 | 'impacts': { |
| 147 | 'extendedStable': testcase.impact_extended_stable_version, |
| 148 | 'stable': testcase.impact_stable_version, |
| 149 | 'beta': testcase.impact_beta_version, |
| 150 | 'head': testcase.impact_head_version, |
| 151 | }, |
| 152 | 'regressionRange': regression_range, |
| 153 | 'fixedRange': fixed_range, |
| 154 | 'groupId': testcase.group_id, |
| 155 | 'projectName': testcase.project_name, |
| 156 | 'platform': testcase.platform, |
| 157 | 'issueId': testcase.bug_information or testcase.group_bug_information, |
| 158 | 'showImpacts': testcase.has_impacts(), |
| 159 | 'impactsProduction': testcase.impacts_production() |
| 160 | } |
| 161 | if testcase.timestamp: |
| 162 | item['timestamp'] = utils.utc_datetime_to_timestamp(testcase.timestamp) |
| 163 | |
| 164 | items.append(item) |
| 165 | |
| 166 | helpers.log('Testcases', helpers.VIEW_OPERATION) |
| 167 | |
| 168 | result = { |
| 169 | 'hasMore': has_more, |
| 170 | 'items': items, |
no test coverage detected