def setUp(self): yield super(TestDatabase, self).setUp() path = os.path.join(self.getStateDir(), 'sqlite') if not os.path.exists(path): os.makedirs(path) self.database = MarketDB(self.getStateDir(), 'market') self.order_id1 = OrderId(TraderId(b'3' * 20), OrderNumber(4)) self.order_id2 = OrderId(TraderId(b'4' * 20), OrderNumber(5)) self.order1 = Order( self.order_id1, AssetPair(AssetAmount(5, 'BTC'), AssetAmount(6, 'EUR')), Timeout(3600), Timestamp.now(), True) self.order2 = Order( self.order_id2, AssetPair(AssetAmount(5, 'BTC'), AssetAmount(6, 'EUR')), Timeout(3600), Timestamp.now(), False) self.order2.reserve_quantity_for_tick( OrderId(TraderId(b'3' * 20), OrderNumber(4)), 3) self.transaction_id1 = TransactionId(TraderId(b'0' * 20), TransactionNumber(4)) self.transaction1 = Transaction( self.transaction_id1, AssetPair(AssetAmount(100, 'BTC'), AssetAmount(30, 'MB')), OrderId(TraderId(b'0' * 20), OrderNumber(1)), OrderId(TraderId(b'1' * 20), OrderNumber(2)), Timestamp(20000)) self.payment1 = Payment(TraderId(b'0' * 20), self.transaction_id1, AssetAmount(5, 'BTC'), WalletAddress('abc'), WalletAddress('def'), PaymentId("abc"), Timestamp(20000), False) self.transaction1.add_payment(self.payment1)
def setUp(self): # Object creation self.wallet_address = WalletAddress("0") self.wallet_address2 = WalletAddress("1")
def test_init(self): # Test for init validation with self.assertRaises(ValueError): WalletAddress(1)
def payment(): transaction_id = TransactionId(b'a' * 32) payment = Payment(TraderId(b'0' * 20), transaction_id, AssetAmount(5, 'BTC'), WalletAddress('abc'), WalletAddress('def'), PaymentId("abc"), Timestamp(20000)) return payment
def from_unpack_list(cls, trader_id, timestamp, transaction_trader_id, transaction_number, incoming_address, outgoing_address): return WalletInfoPayload(TraderId(trader_id), Timestamp(timestamp), TransactionId(TraderId(transaction_trader_id), TransactionNumber(transaction_number)), WalletAddress(incoming_address.decode('utf-8')), WalletAddress(outgoing_address.decode('utf-8')))
def setUp(self): # Object creation self.payment = Payment(TraderId(b'0' * 20), TransactionId(b'a' * 32), AssetAmount(3, 'BTC'), WalletAddress('a'), WalletAddress('b'), PaymentId('aaa'), Timestamp(4000))