From da851b3b05422ffc41f9f59d275a7efed9f1a9a9 Mon Sep 17 00:00:00 2001 From: Joseph Cardillo Date: Tue, 1 Dec 2026 11:29:38 -0500 Subject: [PATCH 1/2] TPT-4571: Add source_image_label to ImageSharingSharedBy --- linode_api4/objects/image.py | 1 + test/unit/objects/image_test.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/linode_api4/objects/image.py b/linode_api4/objects/image.py index 50dc23f74..bc9079c85 100644 --- a/linode_api4/objects/image.py +++ b/linode_api4/objects/image.py @@ -50,6 +50,7 @@ class ImageSharingSharedBy(JSONObject): sharegroup_uuid: Optional[str] = None sharegroup_label: Optional[str] = None source_image_id: Optional[str] = None + source_image_label: Optional[str] = None @dataclass diff --git a/test/unit/objects/image_test.py b/test/unit/objects/image_test.py index 1ea2fd66e..26d08d6ae 100644 --- a/test/unit/objects/image_test.py +++ b/test/unit/objects/image_test.py @@ -132,3 +132,34 @@ def test_image_replication(self): m.call_data, {"regions": ["us-east", "us-west"]}, ) + + def test_shared_image_source_label(self): + for shared_by, expected in ( + ({"source_image_label": "original-image"}, "original-image"), + ({"source_image_label": None}, None), + ({}, None), + ): + with self.subTest(shared_by=shared_by): + image_data = { + "id": "shared/1", + "image_sharing": {"shared_by": shared_by}, + } + + with self.mock_get(image_data): + image = self.client.load(Image, "shared/1") + + self.assertEqual( + image.image_sharing.shared_by.source_image_label, expected + ) + + with self.mock_get({ + "data": [image_data], + "page": 1, + "pages": 1, + "results": 1, + }): + image = self.client.images().first() + + self.assertEqual( + image.image_sharing.shared_by.source_image_label, expected + ) From 8cdc51c8e01bcc756c69c7fe1192bfe6ead6fa03 Mon Sep 17 00:00:00 2001 From: Joseph Cardillo Date: Tue, 1 Dec 2026 12:08:59 -0500 Subject: [PATCH 2/2] fix formatting in image_test.py --- test/unit/objects/image_test.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/unit/objects/image_test.py b/test/unit/objects/image_test.py index 26d08d6ae..6a2056d6c 100644 --- a/test/unit/objects/image_test.py +++ b/test/unit/objects/image_test.py @@ -152,12 +152,14 @@ def test_shared_image_source_label(self): image.image_sharing.shared_by.source_image_label, expected ) - with self.mock_get({ - "data": [image_data], - "page": 1, - "pages": 1, - "results": 1, - }): + with self.mock_get( + { + "data": [image_data], + "page": 1, + "pages": 1, + "results": 1, + } + ): image = self.client.images().first() self.assertEqual(