I have a file I am trying to test. I have been able to test everything but causing a ClientRequestError
with the library. I want to mock the connection to https://dev.azure.com/ms/_apis/projects/calculator and essentially cause a connection error to this endpoint so the library throws the ClientRequestError
.
This is what I am trying to test
from azure.devops.connection import Connection
from azure.devops.exceptions import AzureDevOpsServiceError
from msrest.exceptions import ClientRequestError
...
connection = Connection(
base_url=f"https://dev.azure.com/ms"
)
try:
core_client = connection.clients.get_core_client()
core_client.get_project("calculator")
except AzureDevOpsServiceError as exception:
_LOGGER.warning(exception)
...
except ClientRequestError as exception:
_LOGGER.warning(exception)
...
The ClientRequestError
being the one I want to cover.