def testjob_yaml_summary(request, job): job = get_object_or_404(TestJob, pk=job) check_request_auth(request, job) suites = job.testsuite_set.all() response = HttpResponse(content_type="text/yaml") filename = "lava_%s_summary.yaml" % job.id response["Content-Disposition"] = 'attachment; filename="%s"' % filename yaml_list = [] for test_suite in suites: yaml_list.append(export_testsuite(test_suite)) yaml.dump(yaml_list, response, Dumper=yaml.CDumper) return response
def testjob_yaml_summary(request, job): job = get_object_or_404(TestJob, pk=job) check_request_auth(request, job) suites = job.testsuite_set.all() response = HttpResponse(content_type='text/yaml') filename = "lava_%s_summary.yaml" % job.id response['Content-Disposition'] = 'attachment; filename="%s"' % filename yaml_list = [] for test_suite in suites: yaml_list.append(export_testsuite(test_suite)) yaml.dump(yaml_list, response, Dumper=yaml.CDumper) return response
def get_testjob_suites_list_csv(self, job_id): """ Name ---- `get_testjob_suites_list_csv` (`job_id`) Description ----------- Get the test suites list from job results of given job id in CSV format. Arguments --------- `job_id`: string Job id for which the test suites are required. Return value ------------ This function returns an XML-RPC structures of test suites list from job results in CSV format, provided the user is authenticated with an username and token. """ self._authenticate() if not job_id: raise xmlrpc.client.Fault( 400, "Bad request: TestJob id was not specified.") try: job = TestJob.get_by_job_number(job_id) if not job.can_view(self.user): raise xmlrpc.client.Fault( 401, "Permission denied for user to job %s" % job_id) output = io.StringIO() writer = csv.DictWriter( output, quoting=csv.QUOTE_ALL, extrasaction="ignore", fieldnames=testsuite_export_fields(), ) writer.writeheader() for test_suite in job.testsuite_set.all(): writer.writerow(export_testsuite(test_suite)) except TestJob.DoesNotExist: raise xmlrpc.client.Fault(404, "Specified job not found.") return output.getvalue()
def get_testjob_suites_list_csv(self, job_id): """ Name ---- `get_testjob_suites_list_csv` (`job_id`) Description ----------- Get the test suites list from job results of given job id in CSV format. Arguments --------- `job_id`: string Job id for which the test suites are required. Return value ------------ This function returns an XML-RPC structures of test suites list from job results in CSV format, provided the user is authenticated with an username and token. """ self._authenticate() if not job_id: raise xmlrpclib.Fault(400, "Bad request: TestJob id was not " "specified.") try: job = TestJob.get_by_job_number(job_id) if not job.can_view(self.user): raise xmlrpclib.Fault( 401, "Permission denied for user to job %s" % job_id) output = io.BytesIO() writer = csv.DictWriter( output, quoting=csv.QUOTE_ALL, extrasaction='ignore', fieldnames=testsuite_export_fields()) writer.writeheader() for test_suite in job.testsuite_set.all(): writer.writerow(export_testsuite(test_suite)) except TestJob.DoesNotExist: raise xmlrpclib.Fault(404, "Specified job not found.") return output.getvalue()
def get_testjob_suites_list_yaml(self, job_id): """ Name ---- `get_testjob_suites_list_yaml` (`job_id`) Description ----------- Get the test suites list from job results of given job id in YAML format. Arguments --------- `job_id`: string Job id for which the test suites are required. Return value ------------ This function returns an XML-RPC structures of test suites list from job results in YAML format, provided the user is authenticated with an username and token. """ self._authenticate() if not job_id: raise xmlrpc.client.Fault( 400, "Bad request: TestJob id was not specified.") try: job = TestJob.get_by_job_number(job_id) if not job.can_view(self.user): raise xmlrpc.client.Fault( 401, "Permission denied for user to job %s" % job_id) yaml_list = [] for test_suite in job.testsuite_set.all(): yaml_list.append(export_testsuite(test_suite)) except TestJob.DoesNotExist: raise xmlrpc.client.Fault(404, "Specified job not found.") return yaml.dump(yaml_list)
def get_testjob_suites_list_yaml(self, job_id): """ Name ---- `get_testjob_suites_list_yaml` (`job_id`) Description ----------- Get the test suites list from job results of given job id in YAML format. Arguments --------- `job_id`: string Job id for which the test suites are required. Return value ------------ This function returns an XML-RPC structures of test suites list from job results in YAML format, provided the user is authenticated with an username and token. """ self._authenticate() if not job_id: raise xmlrpclib.Fault(400, "Bad request: TestJob id was not " "specified.") try: job = TestJob.get_by_job_number(job_id) if not job.can_view(self.user): raise xmlrpclib.Fault( 401, "Permission denied for user to job %s" % job_id) yaml_list = [] for test_suite in job.testsuite_set.all(): yaml_list.append(export_testsuite(test_suite)) except TestJob.DoesNotExist: raise xmlrpclib.Fault(404, "Specified job not found.") return yaml.dump(yaml_list)