def setUp(self): self.colordef1 = POBColorDefinition(1, { 'txhash': 'genesis', 'outindex': 0 }) self.colordef2 = OBColorDefinition(2, { 'txhash': 'genesis', 'outindex': 0 }) self.cv1 = SimpleColorValue(colordef=self.colordef1, value=1, label='test') self.cv2 = SimpleColorValue(colordef=self.colordef1, value=2, label='test2') self.cv3 = SimpleColorValue(colordef=self.colordef2, value=1)
def test_compose_tx_spec(self): cv1 = SimpleColorValue(colordef=UNCOLORED_MARKER, value=10000) cv2 = SimpleColorValue(colordef=self.pobc, value=10000) targets = [ColorTarget('addr1', cv1), ColorTarget('addr1', cv2)] txspec = MockOpTxSpec(targets) self.assertTrue( isinstance(self.pobc.compose_tx_spec(txspec), ComposedTxSpec)) cv1 = SimpleColorValue(colordef=UNCOLORED_MARKER, value=20000) cv2 = SimpleColorValue(colordef=self.pobc, value=20000) targets = [ColorTarget('addr1', cv1), ColorTarget('addr1', cv2)] txspec = MockOpTxSpec(targets) self.assertTrue( isinstance(self.pobc.compose_tx_spec(txspec), ComposedTxSpec)) non = OBColorDefinition(2, {'txhash': 'something', 'outindex': 0}) cv3 = SimpleColorValue(colordef=non, value=2) targets = [ColorTarget('addr1', cv3), ColorTarget('addr1', cv2)] txspec = MockOpTxSpec(targets) self.assertRaises(InvalidColorError, self.pobc.compose_tx_spec, txspec)
def setUp(self): self.colordef1 = EPOBCColorDefinition(1, { 'txhash': 'genesis', 'outindex': 0 }) self.colordef2 = OBColorDefinition(2, { 'txhash': 'genesis', 'outindex': 0 }) self.cv1 = SimpleColorValue(colordef=self.colordef1, value=1, label='test') self.cv2 = SimpleColorValue(colordef=self.colordef1, value=2, label='test2') self.cv3 = SimpleColorValue(colordef=self.colordef2, value=1) self.ct1 = ColorTarget('address1', self.cv1) self.ct2 = ColorTarget('address2', self.cv2) self.ct3 = ColorTarget('address3', self.cv3) self.txspec = MockOpTxSpec([self.ct1, self.ct2])
def setUp(self): self.obc = OBColorDefinition(1, {'txhash': 'genesis', 'outindex': 0}) self.genesis_tx = MockTX('genesis', [], []) self.tester = ColorDefinitionTester(self.obc)