'Test encoding and decoding of a start transaction message'

def test_encode_decode_start_transaction(self):

    message = MockObject()
    meta_msg = self.market_community.get_meta_message(u'start-transaction')
    transaction_payload = StartTransactionPayload.Implementation(meta_msg, TraderId('abc'), MessageNumber('3'), TraderId('def'), TransactionNumber(5), TraderId('def'), OrderNumber(3), TraderId('abc'), OrderNumber(4), 1235, Price(5, 'BTC'), Quantity(4, 'MC'), Timestamp.now())
    message.payload = transaction_payload
    (packet,) = self.conversion._encode_start_transaction(message)
    self.assertTrue(packet)
    (_, decoded) = self.conversion._decode_start_transaction(self.get_placeholder_msg(u'start-transaction'), 0, packet)
    self.assertTrue(decoded)
    self.assertEqual(decoded.trader_id, TraderId('abc'))
    self.assertEqual(decoded.transaction_trader_id, TraderId('def'))
