Checks that `span` is of a `method` request to `path`, and that its route is `path` with a placeholder for each ID.
(span: ReadableSpan, method: str, path: str)
| 6954 | |
| 6955 | |
| 6956 | def assert_http_attributes(span: ReadableSpan, method: str, path: str) -> None: |
| 6957 | """Checks that `span` is of a `method` request to `path`, and that its route is `path` with a placeholder for each ID.""" |
| 6958 | assert attributes(span)["http.request.method"] == method |
| 6959 | assert attributes(span)["url.path"] == path |
| 6960 | route = str(attributes(span)["http.route"]) |
| 6961 | assert re.fullmatch(re.sub(r"\\\{\w+\\\}", "[^/]+", re.escape(route)), path), route |
| 6962 | assert route.count("{") == sum(part not in route.split("/") for part in path.split("/")), route |
| 6963 | |
| 6964 | |
| 6965 | # One method of each resource: what calls it, the request it makes, the body of its response, and its span's name and IDs. |
no test coverage detected