register_mock_discovery#
- rubin.repertoire.register_mock_discovery(respx_mock, results, base_url=None)#
Mock out the Repertoire discovery server.
This does not mock retrieval of InfluxDB connection information.
- Parameters:
respx_mock (
Router) – Mock router.results (
Discovery|dict[str,Any] |Path) – Mock results to return when HTTPX code requests service discovery. This can be aDiscoveryobject, the equivalent as adict(using the same syntax as parsed JSON), or aPathto a JSON file.base_url (
str|None, default:None) – Base URL at which to mock the Repertoire service. If this is not given, the environment variableREPERTOIRE_BASE_URLmust be set before calling this function (usually via pytest’smonkeypatch.setenv) and will be used as the default.
- Returns:
Parsed discovery results that will be returned from the mocked endpoint.
- Return type:
- Raises:
RepertoireUrlError – Raised if
REPERTOIRE_BASE_URLis not set in the environment andbase_urlis not provided.