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() df_result = await component.as_dataframe()
assert isinstance(df_result, DataFrame) assert isinstance(df_result, DataFrame)
# Test Message output # Test Data output - to_data returns a list of Data objects
msg_result = await component.as_message() test_data = {"test": "value"}
assert isinstance(msg_result, Message) data_result = component.to_data(test_data)
assert isinstance(data_result, list)
# Test Data output assert all(isinstance(item, Data) for item in data_result)
data_result = await component.as_data()
assert isinstance(data_result, Data)
assert isinstance(data_result.data["output"], list)
async def test_invalid_urls(self, component): async def test_invalid_urls(self, component):
# Test invalid URL handling # Test invalid URL handling