Only metrics that match the 'name[]' query string param appear
(self)
| 192 | assert content_type == "text/plain" |
| 193 | |
| 194 | def test_qs_parsing(self): |
| 195 | """Only metrics that match the 'name[]' query string param appear""" |
| 196 | |
| 197 | app = make_asgi_app(self.registry) |
| 198 | metrics = [ |
| 199 | ("asdf", "first test metric", 1), |
| 200 | ("bsdf", "second test metric", 2) |
| 201 | ] |
| 202 | |
| 203 | for m in metrics: |
| 204 | self.increment_metrics(*m) |
| 205 | |
| 206 | for i_1 in range(len(metrics)): |
| 207 | self.seed_app(app) |
| 208 | self.scope['query_string'] = f"name[]={metrics[i_1][0]}_total".encode("utf-8") |
| 209 | self.send_default_request() |
| 210 | |
| 211 | outputs = self.get_all_output() |
| 212 | response_body = outputs[1] |
| 213 | output = response_body['body'].decode('utf8') |
| 214 | |
| 215 | self.assert_metrics(output, *metrics[i_1]) |
| 216 | |
| 217 | for i_2 in range(len(metrics)): |
| 218 | if i_1 == i_2: |
| 219 | continue |
| 220 | |
| 221 | self.assert_not_metrics(output, *metrics[i_2]) |
| 222 | |
| 223 | asyncio.new_event_loop().run_until_complete( |
| 224 | self.communicator.wait() |
| 225 | ) |
| 226 | |
| 227 | def test_qs_parsing_multi(self): |
| 228 | """Only metrics that match the 'name[]' query string param appear""" |
nothing calls this directly
no test coverage detected