Example #1
0
    def test_get_block_to_mine(self):
        m_block = Mock(autospec=Block, name='mock Block')
        m_block_metadata = Mock(autospec=BlockMetadata, name='mock BlockMetadata', block_difficulty=0)

        with mock._patch_object(ChainManager, 'last_block') as m_last_block:
            m_last_block.__get__ = Mock(return_value=m_block)
            self.chain_manager._state.get_block_metadata.return_value = m_block_metadata

            self.qrlnode.get_block_to_mine(alice.address)

            m_last_block.__get__.assert_called_once()
            self.chain_manager._state.get_block_metadata.assert_called_once()
            self.qrlnode._pow.miner.get_block_to_mine.assert_called_once_with(alice.address, self.chain_manager.tx_pool,
                                                                              m_block, 0)
Example #2
0
 def test_coin_supply(self):
     with mock._patch_object(ChainManager,
                             'total_coin_supply') as m_total_coin_supply:
         m_total_coin_supply.__get__ = Mock(return_value=100)
         self.assertEqual(100, self.qrlnode.coin_supply)
         m_total_coin_supply.__get__.assert_called_once()