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

Method test_favicon_path

tests/test_wsgi.py:69–85  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

67 self.validate_metrics("failed_requests", "Number of failed requests", 7)
68
69 def test_favicon_path(self):
70 from unittest.mock import patch
71
72 # Create mock to enable counting access of _bake_output
73 with patch("prometheus_client.exposition._bake_output", side_effect=_bake_output) as mock:
74 # Create and run WSGI app
75 app = make_wsgi_app(self.registry)
76 # Try accessing the favicon path
77 favicon_environ = dict(self.environ)
78 favicon_environ['PATH_INFO'] = '/favicon.ico'
79 outputs = app(favicon_environ, self.capture)
80 # Test empty response
81 self.assertEqual(outputs, [b''])
82 self.assertEqual(mock.call_count, 0)
83 # Try accessing normal paths
84 app(self.environ, self.capture)
85 self.assertEqual(mock.call_count, 1)
86
87 def test_gzip(self):
88 # Increment a metric

Callers

nothing calls this directly

Calls 1

make_wsgi_appFunction · 0.90

Tested by

no test coverage detected