def test_get_internal_failed_http_error(web_client: WebClient, mocker: MockerFixture) -> None: """ must suppress any exception happened during web service status getting """ mocker.patch("requests.get", side_effect=requests.exceptions.HTTPError()) assert web_client.get_internal() == InternalStatus()
def test_get_internal(web_client: WebClient, mocker: MockerFixture) -> None: """ must return web service status """ response_obj = Response() response_obj._content = json.dumps( InternalStatus(architecture="x86_64").view()).encode("utf8") response_obj.status_code = 200 requests_mock = mocker.patch("requests.get", return_value=response_obj) result = web_client.get_internal() requests_mock.assert_called_once() assert result.architecture == "x86_64"