Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Feb 19, 2025
1 parent e760b7a commit ad2844c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from hexkit.providers.akafka.testutils import KafkaFixture

from mass.core import models
from mass.inject import prepare_event_subscriber
from tests.fixtures.joint import JointFixture

pytestmark = pytest.mark.asyncio()
Expand Down Expand Up @@ -159,11 +158,11 @@ async def test_consume_from_retry(joint_fixture: JointFixture, kafka: KafkaFixtu
}

# define a resource to be upserted
resource = models.Resource(id_="1HotelAlpha-id", content=content)
resource = models.Resource(id_="added-resource", content=content)

# put together event payload
payload = event_schemas.SearchableResource(
accession="1HotelAlpha-id",
accession="added-resource",
class_name=CLASS_NAME,
content=content,
).model_dump()
Expand All @@ -178,12 +177,11 @@ async def test_consume_from_retry(joint_fixture: JointFixture, kafka: KafkaFixtu
)

# Consume the event
async with prepare_event_subscriber(config=config) as event_subscriber:
await event_subscriber.run(forever=False)
await joint_fixture.consume_event()

# verify that the resource was added
updated_resources = await joint_fixture.handle_query(class_name=CLASS_NAME)
assert updated_resources.count == results_all.count
assert updated_resources.count - results_all.count == 1

# remove unselected fields
content = resource.content # type: ignore
Expand Down

0 comments on commit ad2844c

Please sign in to comment.