示例#1
0
    def test_check_confirmations_finalizes_when_confirmed(self, mock_storage_get, mock_finalize, mock_get_last_number, mock_get_last_confirmed):
        level_5_actions._interchain_client.is_transaction_confirmed.return_value = True

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_finalize.assert_called_once()
        mock_storage_get.assert_called_once_with("BLOCK/124")
        level_5_actions._interchain_client.should_retry_broadcast.assert_not_called()
示例#2
0
    def test_check_confirmations_noops_when_no_blocks_to_confirm(
        self, mock_retry, mock_storage_get, mock_finalize, mock_get_last_number, mock_get_last_confirmed
    ):
        level_5_actions._interchain_client.is_transaction_confirmed.return_value = True

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_storage_get.assert_not_called()
        mock_finalize.assert_not_called()
        mock_retry.assert_not_called()
示例#3
0
    def test_check_confirmations_attempts_to_retry_when_not_confirmed(
        self, mock_retry, mock_storage_get, mock_finalize, mock_get_last_number, mock_get_last_confirmed
    ):
        level_5_actions._interchain_client.is_transaction_confirmed.return_value = False

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_storage_get.assert_called_once_with("BLOCK/124")
        mock_finalize.assert_not_called()
        mock_retry.assert_called_once()
    def test_check_confirmations_noops_when_no_blocks_to_confirm(
            self, mock_storage_get, mock_finalize, mock_get_last_number,
            mock_get_last_confirmed):
        level_5_actions.INTERCHAIN.is_transaction_confirmed = MagicMock(
            return_value=True)

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_storage_get.assert_not_called()
        mock_finalize.assert_not_called()
示例#5
0
    def test_check_confirmations_removes_unneeded_hashes(
        self, mock_block_model, mock_retry, mock_storage_get, mock_finalize, mock_get_last_number, mock_get_last_confirmed
    ):
        level_5_actions._interchain_client.is_transaction_confirmed.side_effect = exceptions.TransactionNotFound
        mock_block_model.return_value.transaction_hash = ["1"]

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_finalize.assert_not_called()
        mock_storage_get.assert_called_once_with("BLOCK/124")
        self.assertEqual(mock_block_model.return_value.transaction_hash, [])
    def test_check_confirmations_removes_unneeded_hashes(
            self, mock_retry, mock_storage_get, mock_finalize,
            mock_get_last_number, mock_get_last_confirmed):
        level_5_actions.INTERCHAIN.is_transaction_confirmed = MagicMock(
            return_value="")

        level_5_actions.check_confirmations()

        mock_get_last_number.assert_called_once()
        mock_get_last_confirmed.assert_called_once()
        mock_finalize.assert_not_called()
        mock_storage_get.assert_called_once_with("BLOCK/124")
        mock_retry.assert_called_once()