def test_get_last_executions(self, project_function, test_utils): _, project = project_function.activate() # suite does not exist last_exec = report.get_last_executions([project], 'suite_does_not_exist') assert last_exec[project] == {} # suite with no executions suite_name = 'suite1' test_utils.create_test(project, name='test1') test_utils.create_suite(project, name=suite_name, tests=['test1']) assert last_exec[project] == {} # suite with one execution timestamp = test_utils.run_suite(project, suite_name) last_exec = report.get_last_executions([project], suite_name) assert last_exec[project] == {suite_name: [timestamp]} # multiple executions timestamps = [timestamp] timestamps.append(test_utils.run_suite(project, suite_name)) timestamps.append(test_utils.run_suite(project, suite_name)) last_exec = report.get_last_executions([project], suite_name, limit=2) assert len(last_exec[project][suite_name]) == 2 assert last_exec[project][suite_name][0] == timestamps[1] assert last_exec[project][suite_name][1] == timestamps[2]
def project_health(): project = request.args['project'] _verify_permissions(Permissions.REPORTS_ONLY, project) project_data = report.get_last_executions(projects=[project], suite=None, limit=1) health_data = {} for suite, executions in project_data[project].items(): execution_data = exec_report.get_execution_data(project=project, suite=suite, execution=executions[0]) health_data[suite] = { 'execution': executions[0], 'total': execution_data['total_tests'], 'totals_by_result': execution_data['totals_by_result'] } return jsonify(health_data)
def report_suite_last_executions(): project = request.args['project'] suite = request.args['suite'] _verify_permissions(Permissions.REPORTS_ONLY, project) project_data = report.get_last_executions([project], suite=suite, limit=50) return jsonify(projects=project_data)
def report_last_executions(): user = _get_user_api_or_session() project_list = user.project_list project_data = report.get_last_executions(project_list, limit=5) return jsonify(projects=project_data)