def get_bugs(request, case_ids): """Get the list of bugs that are associated with this test case. :param case_ids: give one or more case IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a case ID. :type case_ids: int, str or list :return: list of mappings of :class:`TestCaseBug`. :rtype: list Example:: # Get bugs belong to ID 1 >>> TestCase.get_bugs(1) # Get bug belong to case ids list [1, 2] >>> TestCase.get_bugs([1, 2]) # Get bug belong to case ids list 1 and 2 with string >>> TestCase.get_bugs('1, 2') """ from tcms.testcases.models import TestCaseBug tcs = TestCase.objects.filter( case_id__in=pre_process_ids(value=case_ids) ) query = {'case__case_id__in': tcs.values_list('case_id', flat=True)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, run_ids): """ *** FIXME: BUGGY IN SERIALISER - List can not be serialize. *** Description: Get the list of bugs attached to this run. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database an array of integers or a comma separated list of integers. Returns: Array: An array of bug object hashes. Example: # Get bugs belong to ID 12345 >>> TestRun.get_bugs(12345) # Get bug belong to run ids list [12456, 23456] >>> TestRun.get_bugs([12456, 23456]) # Get bug belong to run ids list 12456 and 23456 with string >>> TestRun.get_bugs('12456, 23456') """ from tcms.testcases.models import TestCaseBug trs = TestRun.objects.filter(run_id__in=pre_process_ids(value=run_ids)) tcrs = TestCaseRun.objects.filter( run__run_id__in=trs.values_list('run_id', flat=True)) query = { 'case_run__case_run_id__in': tcrs.values_list('case_run_id', flat=True) } return TestCaseBug.to_xmlrpc(query)
def get_bugs_s(request, run_id, case_id, build_id, environment_id=0): """ Description: Get the list of bugs that are associated with this test case. Params: $run_id - Integer: An integer representing the ID of the test run in the database. $case_id - Integer: An integer representing the ID of the test case in the database. $build_id - Integer: An integer representing the ID of the test build in the database. $environment_id - Optional Integer: An integer representing the ID of the environment in the database. Returns: Array: An array of bug object hashes. Example: >>> TestCaseRun.get_bugs_s(3113, 565, 72, 90) """ query = { 'case_run__run': int(run_id), 'case_run__build': int(build_id), 'case_run__case': int(case_id), } # Just keep the same with original implementation that calls # pre_process_tcr_s. In which following logical exists. I don't why this # should happen there exactly. # FIXME: seems it should be `if environment_id is not None`, otherwise such # judgement should not happen. if environment_id: query['case_run__environment_id'] = int(environment_id) return TestCaseBug.to_xmlrpc(query)
def get_bugs_s(request, run_id, case_id, build_id, environment_id=0): """Get the list of bugs that are associated with this test case. :param int case_id: case ID. :param int run_id: run ID. :param int build_id: build ID. :param int environment_id: optional environment ID. Defaults to ``0``. :return: a list of found :class:`TestCaseBug`. :rtype: list[dict] Example:: >>> TestCaseRun.get_bugs_s(1, 2, 3, 4) """ query = { 'case_run__run': int(run_id), 'case_run__build': int(build_id), 'case_run__case': int(case_id), } # Just keep the same with original implementation that calls # pre_process_tcr_s. In which following logical exists. I don't why this # should happen there exactly. # FIXME: seems it should be `if environment_id is not None`, otherwise such # judgement should not happen. if environment_id: query['case_run__environment_id'] = int(environment_id) return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, run_ids): """Get the list of bugs attached to this run. :param run_ids: give one or more run IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a run ID. :type run_ids: int, str or list :return: a list of mappings of :class:`TestCaseBug`. :rtype: list[dict] Example:: # Get bugs belong to ID 12345 >>> TestRun.get_bugs(1) # Get bug belong to run ids list [1, 2] >>> TestRun.get_bugs([1, 2]) # Get bug belong to run ids list 1 and 2 with string >>> TestRun.get_bugs('1, 2') """ from tcms.testcases.models import TestCaseBug trs = TestRun.objects.filter( run_id__in=pre_process_ids(value=run_ids) ) tcrs = TestCaseRun.objects.filter( run__run_id__in=trs.values_list('run_id', flat=True) ) query = {'case_run__case_run_id__in': tcrs.values_list('case_run_id', flat=True)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, run_ids): """ *** FIXME: BUGGY IN SERIALISER - List can not be serialize. *** Description: Get the list of bugs attached to this run. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database an array of integers or a comma separated list of integers. Returns: Array: An array of bug object hashes. Example: # Get bugs belong to ID 12345 >>> TestRun.get_bugs(12345) # Get bug belong to run ids list [12456, 23456] >>> TestRun.get_bugs([12456, 23456]) # Get bug belong to run ids list 12456 and 23456 with string >>> TestRun.get_bugs('12456, 23456') """ from tcms.testcases.models import TestCaseBug trs = TestRun.objects.filter( run_id__in=pre_process_ids(value=run_ids) ) tcrs = TestCaseRun.objects.filter( run__run_id__in=trs.values_list('run_id', flat=True) ) query = {'case_run__case_run_id__in': tcrs.values_list('case_run_id', flat=True)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, case_ids): """Get the list of bugs that are associated with this test case. :param case_ids: give one or more case IDs. It could be an integer, a string containing comma separated IDs, or a list of int each of them is a case ID. :type case_ids: int, str or list :return: list of mappings of :class:`TestCaseBug`. :rtype: list Example:: # Get bugs belong to ID 1 >>> TestCase.get_bugs(1) # Get bug belong to case ids list [1, 2] >>> TestCase.get_bugs([1, 2]) # Get bug belong to case ids list 1 and 2 with string >>> TestCase.get_bugs('1, 2') """ from tcms.testcases.models import TestCaseBug tcs = TestCase.objects.filter(case_id__in=pre_process_ids(value=case_ids)) query = {'case__case_id__in': tcs.values_list('case_id', flat=True)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, case_run_id): """Get the list of bugs that are associated with this test case. :param int case_run_id: case run ID. :return: a list of mappings of :class:`TestCaseBug`. :rytpe: list[dict] Example:: >>> TestCase.get_bugs(10) """ query = {'case_run': int(case_run_id)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, case_run_id): """ Description: Get the list of bugs that are associated with this test case. Params: $case_run_ids - Integer: An integer representing the ID in the database for this case-run. Returns: Array: An array of bug object hashes. Example: >>> TestCase.get_bugs(12345) """ query = {'case_run': int(case_run_id)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(query): """ TODO: duplicate with TestCase.get_bugs Description: Get the list of bugs that are associated with this test case. Params: $query - dict Returns: Array: An array of bug object hashes. Example: >>> TestCase.get_bugs(12345) """ return TestCaseBug.to_xmlrpc(query)
def filter(query): """ .. function:: XML-RPC TestCaseBug.filter(query) Get list of bugs that are associated with TestCase or a TestCaseRun. :param query: Field lookups for :class:`tcms.testcases.models.TestCaseBug` :type query: dict :return: List of serialized :class:`tcms.testcases.models.TestCaseBug` objects. Get all bugs for particular TestCase:: >>> Bug.filter({'case': 123}) or Bug.filter({'case_id': 123}) Get all bugs for a particular TestCaseRun:: >>> Bug.filter({'case_run': 1234}) or Bug.filter({'case_run_id': 1234}) """ return TestCaseBug.to_xmlrpc(query)
def get_bugs(case_ids): """ Description: Get the list of bugs that are associated with this test case. Params: $case_ids - Integer/String: An integer representing the ID in the database Returns: Array: An array of bug object hashes. Example: # Get bugs belong to ID 12345 >>> TestCase.get_bugs(12345) # Get bug belong to case ids list [12456, 23456] >>> TestCase.get_bugs([12456, 23456]) # Get bug belong to case ids list 12456 and 23456 with string >>> TestCase.get_bugs('12456, 23456') """ from tcms.testcases.models import TestCaseBug tcs = TestCase.objects.filter(case_id__in=pre_process_ids(value=case_ids)) query = {'case__case_id__in': tcs.values_list('case_id', flat=True)} return TestCaseBug.to_xmlrpc(query)
def get_bugs(request, case_ids): """ Description: Get the list of bugs that are associated with this test case. Params: $case_ids - Integer/String: An integer representing the ID in the database Returns: Array: An array of bug object hashes. Example: # Get bugs belong to ID 12345 >>> TestCase.get_bugs(12345) # Get bug belong to case ids list [12456, 23456] >>> TestCase.get_bugs([12456, 23456]) # Get bug belong to case ids list 12456 and 23456 with string >>> TestCase.get_bugs('12456, 23456') """ from tcms.testcases.models import TestCaseBug tcs = TestCase.objects.filter( case_id__in=pre_process_ids(value=case_ids) ) query = {'case__case_id__in': tcs.values_list('case_id', flat=True)} return TestCaseBug.to_xmlrpc(query)