Skip to content

Commit

Permalink
chore: Re-activate tests, apply small fixes along the way
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Dec 26, 2024
1 parent 1a6bf1d commit 5a71160
Show file tree
Hide file tree
Showing 8 changed files with 1,481 additions and 1,470 deletions.
30 changes: 15 additions & 15 deletions agents-api/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,21 @@ async def test_session(
return session


# @fixture(scope="global")
# async def test_user_doc(
# dsn=pg_dsn,
# developer_id=test_developer_id,
# user=test_user,
# ):
# async with get_pg_client(dsn=dsn) as client:
# doc = await create_doc(
# developer_id=developer_id,
# owner_type="user",
# owner_id=user.id,
# data=CreateDocRequest(title="Hello", content=["World"]),
# client=client,
# )
# yield doc
@fixture(scope="global")
async def test_user_doc(
dsn=pg_dsn,
developer_id=test_developer_id,
user=test_user,
):
pool = create_db_pool(dsn=dsn)
doc = await create_doc(
developer_id=developer_id,
owner_type="user",
owner_id=user.id,
data=CreateDocRequest(title="Hello", content=["World"]),
connection_pool=pool,
)
yield doc


# @fixture(scope="global")
Expand Down
40 changes: 20 additions & 20 deletions agents-api/tests/test_activities.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# from uuid_extensions import uuid7
# from ward import test
from uuid_extensions import uuid7
from ward import test

# from agents_api.activities.embed_docs import embed_docs
# from agents_api.activities.types import EmbedDocsPayload
# from agents_api.clients import temporal
# from agents_api.env import temporal_task_queue
# from agents_api.workflows.demo import DemoWorkflow
# from agents_api.workflows.task_execution.helpers import DEFAULT_RETRY_POLICY
from agents_api.clients import temporal
from agents_api.env import temporal_task_queue
from agents_api.workflows.demo import DemoWorkflow
from agents_api.workflows.task_execution.helpers import DEFAULT_RETRY_POLICY

# from .fixtures import (
# cozo_client,
# test_developer_id,
# test_doc,
# )
# from .utils import patch_testing_temporal
from .utils import patch_testing_temporal


# @test("activity: call direct embed_docs")
Expand All @@ -39,18 +39,18 @@
# )


# @test("activity: call demo workflow via temporal client")
# async def _():
# async with patch_testing_temporal() as (_, mock_get_client):
# client = await temporal.get_client()
@test("activity: call demo workflow via temporal client")
async def _():
async with patch_testing_temporal() as (_, mock_get_client):
client = await temporal.get_client()

# result = await client.execute_workflow(
# DemoWorkflow.run,
# args=[1, 2],
# id=str(uuid7()),
# task_queue=temporal_task_queue,
# retry_policy=DEFAULT_RETRY_POLICY,
# )
result = await client.execute_workflow(
DemoWorkflow.run,
args=[1, 2],
id=str(uuid7()),
task_queue=temporal_task_queue,
retry_policy=DEFAULT_RETRY_POLICY,
)

# assert result == 3
# mock_get_client.assert_called_once()
assert result == 3
mock_get_client.assert_called_once()
Loading

0 comments on commit 5a71160

Please sign in to comment.