def get_tags(request, values): """ Description: Get the list of tags. Params: $values - Hash: keys must match valid search fields. +------------------------------------------------------------+ | tag Search Parameters | +------------------------------------------------------------+ | Key | Valid Values | | ids | List of Integer | | names | List of String | +------------------------------------------------------------+ Returns: Array: An array of tag object hashes. Example: >>> values= {'ids': [121, 123]} >>> Tag.get_tags(values) """ if values.get('ids'): query = {'id__in': values.get('ids')} return TestTag.to_xmlrpc(query) elif values.get('names'): query = {'name__in': values.get('names')} return TestTag.to_xmlrpc(query) else: raise ValueError('Must specify ids or names at least.')
def get(request, case_id): """ Description: Used to load an existing test case from the database. Params: $id - Integer/String: An integer representing the ID in the database Returns: A blessed TestCase object Hash Example: >>> TestCase.get(1193) """ try: tc = TestCase.objects.get(case_id = case_id) except: raise tc_latest_text = tc.latest_text().serialize() response = tc.serialize() response['text'] = tc_latest_text #get the xmlrpc tags tag_ids = tc.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x:x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response
def get(request, case_id): """ Description: Used to load an existing test case from the database. Params: $id - Integer/String: An integer representing the ID in the database Returns: A blessed TestCase object Hash Example: >>> TestCase.get(1193) """ try: tc = TestCase.objects.get(case_id=case_id) except: raise tc_latest_text = tc.latest_text().serialize() response = tc.serialize() response['text'] = tc_latest_text #get the xmlrpc tags tag_ids = tc.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x: x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response
def get_tags(request, case_id): """ Description: Get the list of tags attached to this case. Params: $case_id - Integer/String: An integer representing the ID in the database Returns: Array: An array of tag object hashes. Example: >>> TestCase.get_tags(12345) """ try: tc = TestCase.objects.get(case_id = case_id) except: raise tag_ids = tc.tag.values_list('id', flat=True) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
def get_tags(request, plan_id): """ Description: Get the list of tags attached to this plan. Params: $plan_id - Integer An integer representing the ID of this plan in the database Returns: Array: An array of tag object hashes. Example: >>> TestPlan.get_tags(137) """ try: tp = TestPlan.objects.get(plan_id = plan_id) except: raise tag_ids = tp.tag.values_list('id', flat=True) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
def get_tags(request, plan_id): """ Description: Get the list of tags attached to this plan. Params: $plan_id - Integer An integer representing the ID of this plan in the database Returns: Array: An array of tag object hashes. Example: >>> TestPlan.get_tags(137) """ try: tp = TestPlan.objects.get(plan_id=plan_id) except: raise tag_ids = tp.tag.values_list('id', flat=True) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
def get_tags(request, case_id): """ Description: Get the list of tags attached to this case. Params: $case_id - Integer/String: An integer representing the ID in the database Returns: Array: An array of tag object hashes. Example: >>> TestCase.get_tags(12345) """ try: tc = TestCase.objects.get(case_id=case_id) except: raise tag_ids = tc.tag.values_list('id', flat=True) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
def get(request, plan_id): """ Description: Used to load an existing test plan from the database. Params: $id - Integer/String: An integer representing the ID of this plan in the database Returns: Hash: A blessed TestPlan object hash Example: >>> TestPlan.get(137) """ tp = TestPlan.objects.get(plan_id=plan_id) response = tp.serialize() #get the xmlrpc tags tag_ids = tp.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x: x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response
def get(request, plan_id): """ Description: Used to load an existing test plan from the database. Params: $id - Integer/String: An integer representing the ID of this plan in the database Returns: Hash: A blessed TestPlan object hash Example: >>> TestPlan.get(137) """ tp = TestPlan.objects.get(plan_id=plan_id) response = tp.serialize() #get the xmlrpc tags tag_ids = tp.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x: x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response
def get_all_cases_tags(request, plan_id): """ Description: Get the list of tags attached to this plan's testcases. Params: $plan_id - Integer An integer representing the ID of this plan in the database Returns: Array: An array of tag object hashes. Example: >>> TestPlan.get_all_cases_tags(137) """ try: tp = TestPlan.objects.get(plan_id=plan_id) except: raise tcs = tp.case.all() tag_ids = [] for tc in tcs.iterator(): tag_ids.extend(tc.tag.values_list('id', flat=True)) tag_ids = list(set(tag_ids)) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
def get_all_cases_tags(request, plan_id): """ Description: Get the list of tags attached to this plan's testcases. Params: $plan_id - Integer An integer representing the ID of this plan in the database Returns: Array: An array of tag object hashes. Example: >>> TestPlan.get_all_cases_tags(137) """ try: tp = TestPlan.objects.get(plan_id=plan_id) except: raise tcs = tp.case.all() tag_ids = [] for tc in tcs.iterator(): tag_ids.extend(tc.tag.values_list('id', flat=True)) tag_ids = list(set(tag_ids)) query = {'id__in': tag_ids} return TestTag.to_xmlrpc(query)
Params: $id - Integer/String: An integer representing the ID of this plan in the database Returns: Hash: A blessed TestPlan object hash Example: >>> TestPlan.get(137) """ try: tp = TestPlan.objects.get(plan_id = plan_id) except TestPlan.DoesNotExist, error: return error response = tp.serialize() #get the xmlrpc tags tag_ids = tp.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x:x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response def get_change_history(request, plan_id): """ *** FIXME: NOT IMPLEMENTED - History is different than before *** Description: Get the list of changes to the fields of this plan. Params: $plan_id - Integer: An integer representing the ID of this plan in the database Returns: Array: An array of hashes with changed fields and their details. """
Params: $run_id - Integer: An integer representing the ID of the run in the database Returns: Hash: A blessed TestRun object hash Example: >>> TestRun.get(1193) """ try: tr = TestRun.objects.get(run_id=run_id) except TestRun.DoesNotExist, error: return error response = tr.serialize() #get the xmlrpc tags tag_ids = tr.tag.values_list('id', flat=True) query = {'id__in': tag_ids} tags = TestTag.to_xmlrpc(query) #cut 'id' attribute off, only leave 'name' here tags_without_id = map(lambda x: x["name"], tags) #replace tag_id list in the serialize return data response["tag"] = tags_without_id return response 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.