Adding upstream version 1.4.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-15 09:34:27 +02:00
parent dc7df702ea
commit 7996c81031
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
166 changed files with 13787 additions and 11959 deletions

View file

@ -429,29 +429,8 @@ REFRESH_PARAMS: list[ParameterSet] = [
pytest.param(
{},
(
{"return_value": False},
{
"return_value": {
"mfgName": "Arista",
"modelName": "DCS-7280CR3-32P4-F",
"hardwareRevision": "11.00",
"serialNumber": "JPE19500066",
"systemMacAddress": "fc:bd:67:3d:13:c5",
"hwMacAddress": "fc:bd:67:3d:13:c5",
"configMacAddress": "00:00:00:00:00:00",
"version": "4.31.1F-34361447.fraserrel (engineering build)",
"architecture": "x86_64",
"internalVersion": "4.31.1F-34361447.fraserrel",
"internalBuildId": "4940d112-a2fc-4970-8b5a-a16cd03fd08c",
"imageFormatVersion": "3.0",
"imageOptimization": "Default",
"bootupTimestamp": 1700729434.5892005,
"uptime": 20666.78,
"memTotal": 8099732,
"memFree": 4989568,
"isIntlVersion": False,
}
},
{"side_effect": HTTPError(message="Unauthorized")},
{},
),
{"is_online": False, "established": False, "hw_model": None},
id="is not online",
@ -613,6 +592,10 @@ class TestAntaDevice:
"""
assert device.cache_statistics == expected
def test_max_connections(self, device: AntaDevice) -> None:
"""Test max_connections property."""
assert device.max_connections is None
class TestAsyncEOSDevice:
"""Test for anta.device.AsyncEOSDevice."""
@ -646,6 +629,16 @@ class TestAsyncEOSDevice:
else:
assert dev1 != dev2
def test_max_connections(self, async_device: AsyncEOSDevice) -> None:
"""Test max_connections property."""
# HTTPX uses a max_connections of 100 by default
assert async_device.max_connections == 100
def test_max_connections_none(self, async_device: AsyncEOSDevice) -> None:
"""Test max_connections property when not available in the session object."""
with patch.object(async_device, "_session", None):
assert async_device.max_connections is None
@pytest.mark.parametrize(
("async_device", "patch_kwargs", "expected"),
REFRESH_PARAMS,
@ -653,9 +646,9 @@ class TestAsyncEOSDevice:
)
async def test_refresh(self, async_device: AsyncEOSDevice, patch_kwargs: list[dict[str, Any]], expected: dict[str, Any]) -> None:
"""Test AsyncEOSDevice.refresh()."""
with patch.object(async_device._session, "check_connection", **patch_kwargs[0]), patch.object(async_device._session, "cli", **patch_kwargs[1]):
with patch.object(async_device._session, "check_api_endpoint", **patch_kwargs[0]), patch.object(async_device._session, "cli", **patch_kwargs[1]):
await async_device.refresh()
async_device._session.check_connection.assert_called_once() # type: ignore[attr-defined] # asynceapi.Device.check_connection is patched
async_device._session.check_api_endpoint.assert_called_once() # type: ignore[attr-defined] # asynceapi.Device.check_api_endpoint is patched
if expected["is_online"]:
async_device._session.cli.assert_called_once() # type: ignore[attr-defined] # asynceapi.Device.cli is patched
assert async_device.is_online == expected["is_online"]