Skip to content

Commit

Permalink
Fix: 'called_once' is not a valid assertion.
Browse files Browse the repository at this point in the history
AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.
  • Loading branch information
hoh committed Jun 10, 2024
1 parent 0c0cfea commit 5a6372f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/unit/test_asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def test_create_post(mock_session_with_post_success):
sync=False,
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(post_message, PostMessage)
assert message_status == MessageStatus.PENDING

Expand All @@ -47,7 +47,7 @@ async def test_create_aggregate(mock_session_with_post_success):
channel="TEST",
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(aggregate_message, AggregateMessage)


Expand Down Expand Up @@ -83,7 +83,7 @@ async def test_create_store(mock_session_with_post_success):
storage_engine=StorageEnum.storage,
)

assert mock_session_with_post_success.http_session.post.called
assert mock_session_with_post_success.http_session.post.assert_called
assert isinstance(store_message, StoreMessage)


Expand All @@ -98,7 +98,7 @@ async def test_create_program(mock_session_with_post_success):
metadata={"tags": ["test"]},
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(program_message, ProgramMessage)


Expand All @@ -118,7 +118,7 @@ async def test_create_instance(mock_session_with_post_success):
hypervisor=HypervisorType.qemu,
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -139,7 +139,7 @@ async def test_create_instance_no_payment(mock_session_with_post_success):
assert instance_message.content.payment.type == PaymentType.hold
assert instance_message.content.payment.chain == Chain.ETH

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -159,7 +159,7 @@ async def test_create_instance_no_hypervisor(mock_session_with_post_success):

assert instance_message.content.environment.hypervisor == HypervisorType.firecracker

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -172,7 +172,7 @@ async def test_forget(mock_session_with_post_success):
channel="TEST",
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(forget_message, ForgetMessage)


Expand Down

0 comments on commit 5a6372f

Please sign in to comment.