chainlib

Generic blockchain access library and tooling
Info | Log | Files | Refs | README | LICENSE

test_interface.py (579B)


      1 # standard imports
      2 import unittest
      3 from unittest.mock import Mock
      4 import logging
      5 
      6 # local imports
      7 from chainlib.interface import ChainInterface
      8 
      9 logg = logging.getLogger()
     10 
     11 
     12 # replace with mocker
     13 def block_from_src(src):
     14     logg.debug('from src called with ' + src)
     15 
     16 
     17 class TestInterface(unittest.TestCase):
     18 
     19     def test_interface_set(self):
     20         ifc = ChainInterface()
     21         block_from_src = Mock()
     22         ifc.set('block_from_src', block_from_src)
     23         ifc.block_from_src('foo')
     24         block_from_src.assert_called()
     25 
     26 
     27 if __name__ == '__main__':
     28     unittest.main()