(raiden_network: List[RaidenService], retry_timeout, unregistered_token)
| 62 | @pytest.mark.parametrize("number_of_tokens", [1]) |
| 63 | @pytest.mark.parametrize("environment_type", [Environment.DEVELOPMENT]) |
| 64 | def test_register_token(raiden_network: List[RaidenService], retry_timeout, unregistered_token): |
| 65 | app1 = raiden_network[0] |
| 66 | registry_address = app1.default_registry.address |
| 67 | token_address = unregistered_token |
| 68 | |
| 69 | # Wait until Raiden can start using the token contract. |
| 70 | # Here, the block at which the contract was deployed should be confirmed by Raiden. |
| 71 | # Therefore, until that block is received. |
| 72 | waiting.wait_for_block( |
| 73 | raiden=app1, |
| 74 | block_number=BlockNumber( |
| 75 | app1.get_block_number() + DEFAULT_NUMBER_OF_BLOCK_CONFIRMATIONS + 1 |
| 76 | ), |
| 77 | retry_timeout=retry_timeout, |
| 78 | ) |
| 79 | |
| 80 | api1 = RaidenAPI(app1) |
| 81 | assert token_address not in api1.get_tokens_list(registry_address) |
| 82 | |
| 83 | api1.token_network_register( |
| 84 | registry_address=registry_address, |
| 85 | token_address=token_address, |
| 86 | channel_participant_deposit_limit=TokenAmount(UINT256_MAX), |
| 87 | token_network_deposit_limit=TokenAmount(UINT256_MAX), |
| 88 | ) |
| 89 | exception = RuntimeError("Did not see the token registration within 30 seconds") |
| 90 | with gevent.Timeout(seconds=30, exception=exception): |
| 91 | wait_for_state_change( |
| 92 | app1, |
| 93 | ContractReceiveNewTokenNetwork, |
| 94 | {"token_network": {"token_address": token_address}}, |
| 95 | retry_timeout, |
| 96 | ) |
| 97 | assert token_address in api1.get_tokens_list(registry_address) |
| 98 | |
| 99 | # Exception if we try to reregister |
| 100 | with pytest.raises(AlreadyRegisteredTokenAddress): |
| 101 | api1.token_network_register( |
| 102 | registry_address=registry_address, |
| 103 | token_address=token_address, |
| 104 | channel_participant_deposit_limit=TokenAmount(UINT256_MAX), |
| 105 | token_network_deposit_limit=TokenAmount(UINT256_MAX), |
| 106 | ) |
| 107 | |
| 108 | |
| 109 | @raise_on_failure |
nothing calls this directly
no test coverage detected