|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
| 3 | +from unittest.mock import MagicMock |
| 4 | + |
3 | 5 | import pytest |
4 | 6 |
|
5 | 7 | from hiero_sdk_python.account.account_id import AccountId |
| 8 | +from hiero_sdk_python.channels import _Channel |
6 | 9 | from hiero_sdk_python.tokens.custom_fee import CustomFee |
7 | 10 | from hiero_sdk_python.tokens.custom_fixed_fee import CustomFixedFee |
8 | 11 | from hiero_sdk_python.tokens.token_fee_schedule_update_transaction import ( |
@@ -114,3 +117,30 @@ def test_build_transaction_body_with_empty_custom_fees(mock_account_ids): |
114 | 117 | assert transaction_body.HasField("token_fee_schedule_update") |
115 | 118 | assert transaction_body.token_fee_schedule_update.token_id == token_id._to_proto() |
116 | 119 | assert len(transaction_body.token_fee_schedule_update.custom_fees) == 0 |
| 120 | + |
| 121 | + |
| 122 | +def test_get_method_returns_token_service_method(): |
| 123 | + channel = _Channel() |
| 124 | + token_service = MagicMock() |
| 125 | + channel._token = token_service |
| 126 | + |
| 127 | + method = TokenFeeScheduleUpdateTransaction()._get_method(channel) |
| 128 | + |
| 129 | + assert method.transaction == token_service.updateTokenFeeSchedule |
| 130 | + |
| 131 | + |
| 132 | +def test_get_method_raises_when_token_service_unavailable(): |
| 133 | + channel = _Channel() |
| 134 | + |
| 135 | + with pytest.raises(ValueError, match="Token service not available on channel"): |
| 136 | + TokenFeeScheduleUpdateTransaction()._get_method(channel) |
| 137 | + |
| 138 | + |
| 139 | +def test_repr_includes_token_id_and_fee_count(mock_account_ids): |
| 140 | + _, _, _, token_id, _ = mock_account_ids |
| 141 | + transaction = TokenFeeScheduleUpdateTransaction(token_id=token_id, custom_fees=[]) |
| 142 | + |
| 143 | + representation = repr(transaction) |
| 144 | + |
| 145 | + assert "TokenFeeScheduleUpdateTransaction" in representation |
| 146 | + assert "fees=0" in representation |
0 commit comments