atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

xray: pagination missing for get_tests_with_test_plan()

Open solarjoe opened this issue 4 years ago • 1 comments
trafficstars

atlassian-python-api 3.12.1

The pagination is also available for Test with Test Plan (https://docs.getxray.app/display/XRAY/Test+Plans+-+REST).

But it's missing in xray.get_tests_with_test_plan()..

It is available with get_tests_with_test_execution() and get_tests_with_test_set()

solarjoe avatar Jul 23 '21 09:07 solarjoe

I implemented the function to monkeypatch it, but I don't have time to create a PR. Here it is:

def get_tests_with_test_plan(self, test_plan_key, limit=None, page=None):
    """
    Retrieve the tests associated with the given test plan.
    :param test_plan_key: Test set key (eg. 'PLAN-001').
    :param limit: OPTIONAL: Limits the number of results per page.
    :param page: OPTIONAL: Number of the page to be returned.
    :return: Return a list of the test associated with the test plan.
    """
    url = "rest/raven/1.0/api/testplan/{0}/test".format(test_plan_key)
    params = {}

    if limit:
        params["limit"] = limit
    if page:
        params["page"] = page

    return self.get(url, params=params)

solarjoe avatar Oct 29 '21 10:10 solarjoe