MockGafaelfawr#
- class rubin.gafaelfawr.MockGafaelfawr#
Bases:
objectMock for the parts of the Gafaelfawr API used by the client.
Methods Summary
create_token(username, *[, scopes])Create a token for the given username.
fail_on(username, actions)Configure the API to fail on requests for the given user.
install_routes(respx_mock, base_url)Install the mock routes for the Gafaelfawr API.
set_user_info(username, user_info)Set the user information for a given user.
Methods Documentation
- create_token(username, *, scopes=None)#
Create a token for the given username.
This token will only be recognized by the same instance of the Gafaelfawr mock.
- fail_on(username, actions)#
Configure the API to fail on requests for the given user.
This can be used by test suites to test handling of Gafaelfawr failures.
- Parameters:
username (
str) – Username for which operations should fail.actions (
Union[MockGafaelfawrAction,Iterable[MockGafaelfawrAction]]) – An action or iterable of actions that should fail. Pass in the empty list to restore regular operations for this user.
- Return type:
- install_routes(respx_mock, base_url)#
Install the mock routes for the Gafaelfawr API.