Пример #1
0
 def test_compose_tx_spec(self):
     cv1 = SimpleColorValue(colordef=UNCOLORED_MARKER, value=1)
     cv2 = SimpleColorValue(colordef=self.obc, value=1)
     target1 = ColorTarget('addr1', cv1)
     target2 = ColorTarget('addr2', cv2)
     targets = [target1, target2]
     txspec = MockOpTxSpec(targets)
     self.assertTrue(
         isinstance(self.obc.compose_tx_spec(txspec), ComposedTxSpec))
     non = POBColorDefinition(2, {'txhash': 'something', 'outindex': 0})
     cv3 = SimpleColorValue(colordef=non, value=1)
     target3 = ColorTarget('addr3', cv3)
     targets = [cv3, cv2]
     txspec = MockOpTxSpec(targets)
     self.assertRaises(InvalidColorError, self.obc.compose_tx_spec, txspec)
Пример #2
0
 def test_compose_genesis_tx_spec(self):
     txspec = MockOpTxSpec([])
     cv = SimpleColorValue(colordef=UNCOLORED_MARKER, value=1)
     self.assertRaises(InvalidTargetError,
                       OBColorDefinition.compose_genesis_tx_spec, txspec)
     target = ColorTarget('addr', cv)
     txspec = MockOpTxSpec([target])
     self.assertRaises(InvalidColorError,
                       OBColorDefinition.compose_genesis_tx_spec, txspec)
     cv = SimpleColorValue(colordef=GENESIS_OUTPUT_MARKER, value=1)
     target = ColorTarget('addr', cv)
     txspec = MockOpTxSpec([target])
     self.assertTrue(
         isinstance(OBColorDefinition.compose_genesis_tx_spec(txspec),
                    ComposedTxSpec))