Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.


### Tests

- Formatted `tests/unit/conftest.py` with black for code style consistency. (#1522)
- format `black tests/unit/nft_id_test.py` with Black.(#1544)
- Format `tests/unit/executable_test.py` with Black.(#1530)
- Format `tests/unit/hedera_trust_manager_test.py` with Black for consistent code style (#1539)
Expand Down Expand Up @@ -132,6 +134,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
- Add automated bot to recommend next issues to contributors after their first PR merge (#1380)
- Added dry-run support and refactored `.github/workflows/bot-workflows.yml` to use dedicated script `.github/scripts/bot-workflows.js` for improved maintainability and testability. (`#1288`)

### Changed

### Documentation
- Added comprehensive docstring to `compress_with_cryptography` function (#1626)

Expand Down
23 changes: 20 additions & 3 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

FAKE_CERT_HASH = hashlib.sha384(FAKE_CERT_PEM).hexdigest().encode("utf-8")


@pytest.fixture
def mock_account_ids():
"""Fixture to provide mock account IDs and token IDs."""
Expand All @@ -33,66 +34,82 @@ def mock_account_ids():
node_account_id = AccountId(0, 0, 3)
token_id_1 = TokenId(1, 1, 1)
token_id_2 = TokenId(2, 2, 2)
return account_id_sender, account_id_recipient, node_account_id, token_id_1, token_id_2
return (
account_id_sender,
account_id_recipient,
node_account_id,
token_id_1,
token_id_2,
)


@pytest.fixture
def amount():
"""Fixture to provide a default amount for fungible tokens."""
return 1000


@pytest.fixture
def metadata():
"""Fixture to provide mock metadata for NFTs."""
return [b'a']


@pytest.fixture
def transaction_id():
"""Fixture that generates a transaction ID for testing."""
return TransactionId.generate(AccountId(0, 0, 1234))


@pytest.fixture
def private_key():
"""Fixture to generate a private key for testing."""
return PrivateKey.generate()


@pytest.fixture
def topic_id():
"""Fixture to create a topic ID for testing."""
return TopicId(0, 0, 1234)


@pytest.fixture
def nft_id():
"""Fixture to provide a mock NftId instance."""
token_id = TokenId(shard=0, realm=0, num=1)
serial_number = 8
return NftId(token_id=token_id, serial_number=serial_number)


@pytest.fixture
def token_id():
"""Fixture to provide a mock TokenId instance."""
return TokenId(shard=0, realm=0, num=3)


@pytest.fixture
def file_id():
"""Fixture to provide a mock FileId instance."""
return FileId(shard=0, realm=0, file=2)


@pytest.fixture
def contract_id():
"""Fixture to provide a mock ContractId instance."""
return ContractId(shard=0, realm=0, contract=1)


@pytest.fixture
def mock_client():
"""Fixture to provide a mock client with hardcoded nodes for testing purposes."""
# Mock Node
node = _Node(
AccountId(0, 0, 3),
"node1.example.com:50211",
address_book=NodeAddress(cert_hash=FAKE_CERT_HASH, addresses=[])
address_book=NodeAddress(cert_hash=FAKE_CERT_HASH, addresses=[]),
)
node._fetch_server_certificate_pem = lambda: FAKE_CERT_PEM

nodes = [node]

network = Network(nodes=nodes)
Expand Down