1

https://bravado.readthedocs.io/en/stable/testing.html demonstrates that one can Mock a specific endpoint of an OpenAPI client as so:

def test_get_available_pet_photos(mock_client):
    mock_client.pet.findPetsByStatus.return_value.response = BravadoResponseMock(
        result=mock_pets,
    )

but how can I mock any endpoint invocation. For example:

def test_get_available_pet_photos(mock_client):
    mock_client.Any.return_value.response = BravadoResponseMock(
        result=mock_pets,
    )

This would allow me to set the response to a function that can control the response in a uniform way and I'll have prior knowledge of the order of calls so I can properly inject the correct responses. Is this something that can be done?

LeanMan
  • 474
  • 1
  • 4
  • 18

0 Answers0