Skip to content

Conversation

@mat-mil
Copy link
Contributor

@mat-mil mat-mil commented May 22, 2025

Issue being resolved: #301

Solution description

How are we solving the problem?
__get_all_entities() method needs more work than this easy fix.

  1. The API of TestRail 8.0.6 response.response_text["_links"]["next"] and the link inside does not contain ? marking the start of query parameters so it is not easy to parse with built-in libraries (e.g. urllib.parse.urlparse())
  2. One of the requests mentioned in __get_all_sections() method sets query parameter limit to 0 and fails with 400 Bad Request response #301 has query-param-like entity appended and set to 0, which causes the server to respond with 400 Bad Request.
    Pay attention to this URL
    url: https://<redacted>/api/v2/get_sections/<project_id>&suite_id=<suite_id>&limit=0&offset=0
    There is no ? so technically (based on urllib.parse.urlparse) there are no query parameters at all.
  3. Having this in mind, we only check whether the limit=0 string exists in response.response_text["_links"]["next"] and if that's true, we replace it with limit=250

Changes

Explained above

Potential impacts

Don't see. Ideally it should not be a hardcoded value. Maybe it should be investigated further why TestRail API returns such link in response.response_text["_links"]["next"] bodies.

Steps to test

Follow reproduction steps from #301

PR Tasks

  • PR reference added to issue
  • README updated
  • Unit tests added/updated

@acuanico-tr-galt acuanico-tr-galt merged commit 0e9f6b5 into gurock:main Jun 4, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__get_all_sections() method sets query parameter limit to 0 and fails with 400 Bad Request response

2 participants