From 3ae7517d9d205fe1ad40cb03e4e7d2dc69416c65 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 18 Aug 2026 07:25:25 +0000 Subject: [PATCH] Auto commit from main repo: manual-sync --- armis_sdk/core/base_entity.py | 3 +-- poetry.lock | 2 +- pyproject.toml | 4 +-- tests/armis_sdk/clients/sites_client_test.py | 28 +++++++++++++++++--- tests/armis_sdk/entities/device_test.py | 5 ++-- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/armis_sdk/core/base_entity.py b/armis_sdk/core/base_entity.py index b08137d..ee6552a 100644 --- a/armis_sdk/core/base_entity.py +++ b/armis_sdk/core/base_entity.py @@ -1,14 +1,13 @@ from typing import TypeVar -from pydantic import alias_generators from pydantic import BaseModel from pydantic import ConfigDict class BaseEntity(BaseModel): model_config = ConfigDict( - alias_generator=alias_generators.to_camel, populate_by_name=True, + serialize_by_alias=True, strict=True, ) diff --git a/poetry.lock b/poetry.lock index cb0a070..8308e54 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1743,4 +1743,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.9" -content-hash = "c87f9fabe58c94133995152e57db1001cdf444e9b57504c615cc0a5f8e20f411" +content-hash = "989e6942653dbd599b0f5d57ff2fc9b353fcdd1353d41ac83100f94d4bcbddc5" diff --git a/pyproject.toml b/pyproject.toml index d21faf0..4fc4397 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "armis_sdk" -version = "1.2.2" +version = "1.2.3" description = "The Armis SDK is a package that encapsulates common use-cases for interacting with the Armis platform." authors = [ { name = "Shai Lachmanovich", email = "shai@armis.com" }, @@ -20,7 +20,7 @@ plugins = ['pydantic.mypy'] eval_type_backport = "*" pandas = "*" pyarrow = "*" -pydantic = "*" +pydantic = ">=2.11" httpx = "*" httpx-retries = "*" universalasync = "*" diff --git a/tests/armis_sdk/clients/sites_client_test.py b/tests/armis_sdk/clients/sites_client_test.py index c5a6e08..78f7b4f 100644 --- a/tests/armis_sdk/clients/sites_client_test.py +++ b/tests/armis_sdk/clients/sites_client_test.py @@ -20,6 +20,7 @@ async def test_create(httpx_mock: pytest_httpx.HTTPXMock): "parent_id": 2, "network_equipment_device_ids": [1, 2, 3], "integration_ids": [4, 5, 6], + "asq_rule": {"or": ["asq1", "asq2"]}, }, json={ "id": "1", @@ -28,6 +29,7 @@ async def test_create(httpx_mock: pytest_httpx.HTTPXMock): "parent_id": 2, "network_equipment_device_ids": [1, 2, 3], "integration_ids": [4, 5, 6], + "asq_rule": {"or": ["asq1", "asq2"]}, }, ) @@ -37,6 +39,7 @@ async def test_create(httpx_mock: pytest_httpx.HTTPXMock): parent_id=2, network_equipment_device_ids=[1, 2, 3], integration_ids=[4, 5, 6], + asq_rule=AsqRule(or_=["asq1", "asq2"]), ) sites_client = SitesClient() @@ -49,6 +52,7 @@ async def test_create(httpx_mock: pytest_httpx.HTTPXMock): parent_id=2, network_equipment_device_ids=[1, 2, 3], integration_ids=[4, 5, 6], + asq_rule=AsqRule(or_=["asq1", "asq2"]), ) @@ -294,20 +298,38 @@ async def test_update_simple_properties(httpx_mock: pytest_httpx.HTTPXMock): httpx_mock.add_response( url="https://api.armis.com/v3/settings/sites/1", method="PATCH", - match_json={"name": "new_name", "location": "new location", "parent_id": 2}, + match_json={ + "name": "new_name", + "location": "new location", + "parent_id": 2, + "asq_rule": {"or": ["asq1", "asq2"]}, + }, json={ "id": 1, "name": "new_name", "location": "new location", "parent_id": 2, + "asq_rule": {"or": ["asq1", "asq2"]}, }, ) sites_client = SitesClient() - site = Site(id=1, name="new_name", location="new location", parent_id=2) + site = Site( + id=1, + name="new_name", + location="new location", + parent_id=2, + asq_rule=AsqRule(or_=["asq1", "asq2"]), + ) updated_site = await sites_client.update(site) - assert updated_site == Site(id=1, name="new_name", location="new location", parent_id=2) + assert updated_site == Site( + id=1, + name="new_name", + location="new location", + parent_id=2, + asq_rule=AsqRule(or_=["asq1", "asq2"]), + ) async def test_update_without_id(httpx_mock: pytest_httpx.HTTPXMock): diff --git a/tests/armis_sdk/entities/device_test.py b/tests/armis_sdk/entities/device_test.py index 9cf94c1..c60b198 100644 --- a/tests/armis_sdk/entities/device_test.py +++ b/tests/armis_sdk/entities/device_test.py @@ -19,6 +19,5 @@ def test_device_model_json_schema_includes_datetime_fields(): """datetime.datetime fields must appear in the JSON schema (regression: TYPE_CHECKING import drops them).""" schema = Device.model_json_schema() props = schema.get("properties", {}) - # Fields use camelCase aliases per BaseEntity's alias_generator - assert "firstSeen" in props, f"firstSeen missing from schema properties: {sorted(props.keys())}" - assert "lastSeen" in props, f"lastSeen missing from schema properties: {sorted(props.keys())}" + assert "first_seen" in props, f"first_seen missing from schema properties: {sorted(props.keys())}" + assert "last_seen" in props, f"last_seen missing from schema properties: {sorted(props.keys())}"