Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Oct 11, 2024
1 parent 15d204c commit e1569be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions payments_py/ai_query_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ async def subscribe(self, callback: Any, did: Optional[str]=None, events: Option
print('query-api:: Connected to the server')
try:
pending_steps = self.get_steps(AgentExecutionStatus.Pending)
if callback is not None:
await callback(pending_steps.json()['steps'])
await self._emit_events(pending_steps.json()['steps'])
except Exception as e:
print('query-api:: Unable to get pending events', e)
Expand Down
8 changes: 4 additions & 4 deletions tests/protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ async def eventsReceived(data):
'output': 'success',
'is_last': True
})
response_data = data
response_event.set()
print(result.json())
response_data = data
response_event.set()
print(result.json())


@pytest.mark.asyncio(loop_scope="module")
Expand Down Expand Up @@ -118,7 +118,7 @@ async def test_AIQueryApi_create_task(ai_query_api_build_fixture, ai_query_api_s
task = subscriber.ai_protocol.create_task(agent.did, {'query': 'sample_query', 'name': 'sample_task', 'additional_params': {'param1': 'value1', 'param2': 'value2'}})
print('Task created:', task.json())

await asyncio.wait_for(response_event.wait(), timeout=60)
await asyncio.wait_for(response_event.wait(), timeout=10)

assert response_data is not None, "Builder did not receive the event from subscriber"
print('Task received by builder:', response_data)
Expand Down

0 comments on commit e1569be

Please sign in to comment.