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

Method test_gzip

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

Source from the content-addressed store, hash-verified

142 self.validate_metrics("failed_requests", "Number of failed requests", 7)
143
144 def test_gzip(self):
145 # Increment a metric.
146 metric_name = "counter"
147 help_text = "A counter"
148 increments = 2
149 self.increment_metrics(metric_name, help_text, increments)
150 app = make_asgi_app(self.registry)
151 self.seed_app(app)
152 # Send input with gzip header.
153 self.scope["headers"] = [(b"accept-encoding", b"gzip")]
154 self.send_input({"type": "http.request", "body": b""})
155 # Assert outputs are compressed.
156 outputs = self.get_all_output()
157 self.assert_outputs(outputs, metric_name, help_text, increments, compressed=True)
158
159 def test_gzip_disabled(self):
160 # Increment a metric.

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