MCPcopy Index your code
hub / github.com/prometheus/client_python / test_gzip_disabled

Method test_gzip_disabled

tests/test_asgi.py:159–173  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

157 self.assert_outputs(outputs, metric_name, help_text, increments, compressed=True)
158
159 def test_gzip_disabled(self):
160 # Increment a metric.
161 metric_name = "counter"
162 help_text = "A counter"
163 increments = 2
164 self.increment_metrics(metric_name, help_text, increments)
165 # Disable compression explicitly.
166 app = make_asgi_app(self.registry, disable_compression=True)
167 self.seed_app(app)
168 # Send input with gzip header.
169 self.scope["headers"] = [(b"accept-encoding", b"gzip")]
170 self.send_input({"type": "http.request", "body": b""})
171 # Assert outputs are not compressed.
172 outputs = self.get_all_output()
173 self.assert_outputs(outputs, metric_name, help_text, increments, compressed=False)
174
175 def test_openmetrics_encoding(self):
176 """Response content type is application/openmetrics-text when appropriate Accept header is in request"""

Callers

nothing calls this directly

Calls 6

increment_metricsMethod · 0.95
seed_appMethod · 0.95
send_inputMethod · 0.95
get_all_outputMethod · 0.95
assert_outputsMethod · 0.95
make_asgi_appFunction · 0.90

Tested by

no test coverage detected