'Test the general check of the validity of a trade message in the market community'

@blocking_call_on_reactor_thread
def test_check_trade_message(self):

    self.proposed_trade.recipient_order_id._trader_id = TraderId('abcdef')
    self.market_community.update_ip(TraderId(self.market_community.mid), ('2.2.2.2', 2))
    self.market_community.update_ip(TraderId('abcdef'), ('2.2.2.2', 2))
    self.market_community.timeline.check = (lambda _: (False, None))
    [self.assertIsInstance(msg, DelayMessageByProof) for msg in self.market_community.check_trade_message([self.get_proposed_trade_msg()])]
    self.market_community.timeline.check = (lambda _: (True, None))
    [self.assertIsInstance(msg, DropMessage) for msg in self.market_community.check_trade_message([self.get_proposed_trade_msg()])]
    self.proposed_trade.recipient_order_id._trader_id = TraderId(self.market_community.mid)
    self.market_community.timeline.check = (lambda _: (True, None))
    [self.assertIsInstance(msg, DropMessage) for msg in self.market_community.check_trade_message([self.get_proposed_trade_msg()])]
    self.market_community.order_manager.order_repository.add(self.order)
    self.market_community.timeline.check = (lambda _: (True, None))
    [self.assertIsInstance(msg, Message.Implementation) for msg in self.market_community.check_trade_message([self.get_proposed_trade_msg()])]
