Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfior committed Dec 12, 2024
1 parent 78303c3 commit a8c92b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions prediction_market_agent/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from prediction_market_agent_tooling.tools.utils import DatetimeUTC
from prediction_market_agent_tooling.tools.web3_utils import wei_to_xdai
from pydantic import computed_field
from sqlalchemy import BigInteger, Column, Numeric
from sqlalchemy import Column, Numeric
from sqlmodel import Field, SQLModel

from prediction_market_agent.tools.message_utils import decompress_message
Expand Down Expand Up @@ -80,7 +80,7 @@ class BlockchainMessage(SQLModel, table=True):
consumer_address: str
sender_address: str
transaction_hash: str = Field(unique=True)
block: int = Field(sa_column=Column(BigInteger, nullable=False))
block: int = Field(sa_column=Column(Numeric, nullable=False))
value_wei: int = Field(sa_column=Column(Numeric, nullable=False))
data_field: Optional[str]

Expand Down
10 changes: 5 additions & 5 deletions tests/agents/microchain/test_messages_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ def agent2_address() -> ChecksumAddress:
# Random transactions found on Gnosisscan.
MOCK_HASH_1 = "0x5ba6dd51d3660f98f02683e032daa35644d3f7f975975da3c2628a5b4b1f5cb6"
MOCK_HASH_2 = "0x429f61ea3e1afdd104fdd0a6f3b88432ec4c7b298fd126378e53a63bc60fed6a"
MOCK_SENDER_SPICE_QUERY = Web3.to_checksum_address(
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
) # anvil account 1


def mock_spice_query(query: str, api_key: str) -> pl.DataFrame:
anvil_account_1 = Web3.to_checksum_address(
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
)
return pl.DataFrame(
{
"hash": [MOCK_HASH_1, MOCK_HASH_2],
"value": [xdai_to_wei(xdai_type(1)), xdai_to_wei(xdai_type(2))],
"block_number": [1, 2],
"from": [anvil_account_1, anvil_account_1],
"from": [MOCK_SENDER_SPICE_QUERY, MOCK_SENDER_SPICE_QUERY],
"data": ["test", Web3.to_hex(compress_message("test"))],
}
)
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_receive_message_call(

blockchain_message = r()
assert blockchain_message is not None
assert blockchain_message.transaction_hash == MOCK_HASH_1
assert MOCK_SENDER_SPICE_QUERY in blockchain_message


def test_receive_message_then_check_count_unseen_messages(
Expand Down

0 comments on commit a8c92b4

Please sign in to comment.