test: update api-request tests (#7231)

 (test_api_request_component.py): refactor test to check if to_data method returns a list of Data objects
This commit is contained in:
Cristhian Zanforlin Lousa 2025-03-22 23:19:29 -03:00 committed by GitHub
commit 7aeb30926b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 576 additions and 707 deletions

File diff suppressed because one or more lines are too long

View file

@ -245,14 +245,11 @@ class TestAPIRequestComponent(ComponentTestBaseWithoutClient):
df_result = await component.as_dataframe()
assert isinstance(df_result, DataFrame)
# Test Message output
msg_result = await component.as_message()
assert isinstance(msg_result, Message)
# Test Data output
data_result = await component.as_data()
assert isinstance(data_result, Data)
assert isinstance(data_result.data["output"], list)
# Test Data output - to_data returns a list of Data objects
test_data = {"test": "value"}
data_result = component.to_data(test_data)
assert isinstance(data_result, list)
assert all(isinstance(item, Data) for item in data_result)
async def test_invalid_urls(self, component):
# Test invalid URL handling