@@ -130,18 +130,35 @@ async def test_list_custom_component_installations() -> None:
130130
131131 result = await list_custom_component_installations (client , "test-workspace" )
132132
133- assert "# Custom Component Installations (showing 2 of 2)" in result
134- assert "## Installation comp_123..." in result
135- assert "## Installation comp_456..." in result
136- assert "**Status**: installed" in result
137- assert "**Status**: failed" in result
138- assert "**Version**: 1.0.0" in result
139- assert "**Version**: 0.9.0" in result
140- assert "**Installed by**: John Doe (john.doe@example.com)" in result
141- assert "**Installed by**: Jane Smith (jane.smith@example.com)" in result
142- assert "[INFO] Installation complete" in result
143- assert "[ERROR] Installation failed" in result
144- assert "[DEBUG] Debug info" in result
133+ assert isinstance (result , CustomComponentInstallationList )
134+ assert len (result .data ) == 2
135+ assert result .total == 2
136+ assert result .has_more is False
137+
138+ # Check first installation
139+ first_install = result .data [0 ]
140+ assert first_install .custom_component_id == "comp_123"
141+ assert first_install .status == "installed"
142+ assert first_install .version == "1.0.0"
143+ assert first_install .created_by_user_id == "user_123"
144+ assert len (first_install .logs ) == 1
145+ assert first_install .logs [0 ]["level" ] == "INFO"
146+ assert first_install .user_info is not None
147+ assert first_install .user_info .given_name == "John"
148+ assert first_install .user_info .family_name == "Doe"
149+ assert first_install .user_info .email == "john.doe@example.com"
150+
151+ # Check second installation
152+ second_install = result .data [1 ]
153+ assert second_install .custom_component_id == "comp_456"
154+ assert second_install .status == "failed"
155+ assert second_install .version == "0.9.0"
156+ assert second_install .created_by_user_id == "user_456"
157+ assert len (second_install .logs ) == 2
158+ assert second_install .user_info is not None
159+ assert second_install .user_info .given_name == "Jane"
160+ assert second_install .user_info .family_name == "Smith"
161+ assert second_install .user_info .email == "jane.smith@example.com"
145162
146163
147164@pytest .mark .asyncio
@@ -162,7 +179,10 @@ async def test_list_custom_component_installations_empty() -> None:
162179
163180 result = await list_custom_component_installations (client , "test-workspace" )
164181
165- assert result == "No custom component installations found."
182+ assert isinstance (result , CustomComponentInstallationList )
183+ assert len (result .data ) == 0
184+ assert result .total == 0
185+ assert result .has_more is False
166186
167187
168188@pytest .mark .asyncio
@@ -192,7 +212,10 @@ async def test_list_custom_component_installations_user_fetch_error() -> None:
192212
193213 result = await list_custom_component_installations (client , "test-workspace" )
194214
195- assert "**Installed by**: Unknown" in result
215+ assert isinstance (result , CustomComponentInstallationList )
216+ assert len (result .data ) == 1
217+ assert result .data [0 ].created_by_user_id == "user_unknown"
218+ assert result .data [0 ].user_info is None # User fetch failed, so user_info should be None
196219
197220
198221@pytest .mark .asyncio
@@ -220,7 +243,7 @@ async def test_get_latest_custom_component_installation_logs() -> None:
220243
221244 result = await get_latest_custom_component_installation_logs (client , "test-workspace" )
222245
223- assert result == f"Latest custom component installation logs: \n \n { mock_logs } "
246+ assert result == mock_logs
224247
225248
226249@pytest .mark .asyncio
@@ -242,5 +265,5 @@ async def test_get_latest_custom_component_installation_logs_api_error() -> None
242265 )
243266 client = FakeClient (custom_components_resource = custom_components_resource )
244267
245- with pytest . raises ( UnexpectedAPIError ):
246- await get_latest_custom_component_installation_logs ( client , "test-workspace" )
268+ result = await get_latest_custom_component_installation_logs ( client , "test-workspace" )
269+ assert result == "Failed to retrieve latest installation logs: API Error (Status Code: 500)"
0 commit comments