def test_channel_settled_event_handler_leaves_existing_channel(context: Context): context = setup_state_with_closed_channel(context) event = ReceiveChannelSettledEvent( token_network_address=DEFAULT_TOKEN_NETWORK_ADDRESS, channel_identifier=ChannelID(4), block_number=BlockNumber(52), ) channel_settled_event_handler(event, context) assert context.database.channel_count() == 1 assert_channel_state(context, ChannelState.CLOSED)
def test_channel_settled_event_handler_settles_existing_channel(context: Context,): context = setup_state_with_closed_channel(context) event = ReceiveChannelSettledEvent( token_network_address=DEFAULT_TOKEN_NETWORK_ADDRESS, channel_identifier=DEFAULT_CHANNEL_IDENTIFIER, block_number=BlockNumber(52), ) channel_settled_event_handler(event, context) assert context.db.channel_count() == 1 assert_channel_state(context, ChannelState.SETTLED)